Commit Graph

311 Commits

Author SHA1 Message Date
Mike Bayer abb10856dc - case() interprets the "THEN" expressions
as values by default, meaning case([(x==y, "foo")]) will
interpret "foo" as a bound value, not a SQL expression.
use text(expr) for literal SQL expressions in this case.
For the criterion itself, these may be literal strings
only if the "value" keyword is present, otherwise SA
will force explicit usage of either text() or literal().
2008-04-03 16:34:03 +00:00
Ants Aasma 921efb250c The case() function now also takes a dictionary as its whens parameter. But beware that it doesn't escape literals, use the literal construct for that. 2008-04-03 14:08:22 +00:00
Mike Bayer f16c41b00b fixed OracleRaw type adaptation [ticket:902] 2008-04-02 17:34:24 +00:00
Mike Bayer 7512b5e548 - schema-qualified tables now will place the schemaname
ahead of the tablename in all column expressions as well
as when generating column labels.  This prevents cross-
schema name collisions in all cases [ticket:999]
- the "use_schema" argument to compiler.visit_column() is removed.  It uses
schema in all cases now.
- added a new test to the PG dialect to test roundtrip insert/update/delete/select
statements with full schema qualification
2008-03-30 21:48:19 +00:00
Mike Bayer 30020880d9 - can now allow selects which correlate all FROM clauses
and have no FROM themselves.  These are typically
used in a scalar context, i.e. SELECT x, (SELECT x WHERE y)
FROM table.  Requires explicit correlate() call.
2008-03-28 15:55:26 +00:00
Mike Bayer fc2cf22038 - fixed SQL function truncation of trailing underscores
[ticket:996]
2008-03-25 17:25:20 +00:00
Jason Kirtland 92a5df7753 - Added generic func.random (non-standard SQL) 2008-03-25 16:51:29 +00:00
Mike Bayer bade0092d1 removed AbstractClauseProcessor, merged its copy-and-visit behavior into ClauseVisitor 2008-03-24 23:55:21 +00:00
Mike Bayer 8d0c5672f0 added escape kw arg to contains(), startswith(), endswith(), [ticket:791] 2008-03-19 20:25:51 +00:00
Mike Bayer 0cc04e6e1b - like() and ilike() take an optional keyword argument
"escape=<somestring>", which is set as the escape character
using the syntax "x LIKE y ESCAPE '<somestring>'"
[ticket:993]
2008-03-19 19:35:42 +00:00
Jason Kirtland 031c500ff4 - Column._set_parent will complete the key==name contract for instances constructed anonymously 2008-03-18 03:07:54 +00:00
Jason Kirtland f979c19841 - 'name' is no longer a require constructor argument for Column(). It (and .key) may now be deferred until the Column is added to a Table. 2008-03-18 00:15:34 +00:00
Jason Kirtland aa033afeee Added support for vendor-extended INSERT syntax like INSERT DELAYED INTO 2008-03-07 16:56:37 +00:00
Mike Bayer 8e0ea84c33 - fixed bug which was preventing UNIONS from being cloneable,
[ticket:986]
2008-03-04 18:20:09 +00:00
Mike Bayer 7f43bc55e0 - can again create aliases of selects against textual
FROM clauses, [ticket:975]
2008-02-19 23:46:14 +00:00
Mike Bayer 84485fb7bb - fixed bug in result proxy where anonymously generated
column labels would not be accessible using their straight
string name
2008-02-14 18:22:47 +00:00
Mike Bayer 9fffa2c7e1 - fixed bug introduced in r4070 where union() and other compound selects would not get
an OID column if it only contained one selectable element, due to missing return in _proxy_column()
- visit_column() calls itself to render a primary key col being used as the interpretation of the oid col instead of relying upon broken partial logic
2008-02-12 21:16:31 +00:00
Mike Bayer c0b5a0446b - updated the naming scheme of the base test classes in test/testlib/testing.py;
tests extend from either TestBase or ORMTest, using additional mixins for
special assertion methods as needed
2008-02-11 00:28:39 +00:00
Mike Bayer 842934f40c - added generative where(<criterion>) method to delete()
and update() constructs which return a new object with
criterion joined to existing criterion via AND, just
like select().where().
- compile assertions use assertEquals()
2008-02-08 22:57:45 +00:00
Jason Kirtland 1b228e8481 - Added deferrability support to constraints 2008-02-08 20:50:33 +00:00
Lele Gaifax 668a8ae21b Avoid using common keywords as field names: the test executes literal selects 2008-02-06 17:52:48 +00:00
Mike Bayer 6c73fbb422 *more* tweaks to avoid DEFAULT VALUES on sqlite 2008-02-04 22:40:52 +00:00
Mike Bayer d2f9015c12 lock in replacing '%' with '%%' 2008-02-04 22:35:29 +00:00
Mike Bayer bb1dd85dcc - add dummy column to appease older SQLite verisons in unicode.py
- add test "escape_literal_column" comiler method to start addressing literal '%' character
2008-02-04 21:47:42 +00:00
Jason Kirtland 0de289921c - ColumnDefault callables can now be any kind of compliant callable, previously only actual functions were allowed. 2008-02-04 20:49:38 +00:00
Mike Bayer a0ffeb5464 - some consolidation of tests in select.py, moved
other tests to more specific modules
- added "now()" as a generic function; on SQLite and
Oracle compiles as "CURRENT_TIMESTAMP"; "now()"
on all others [ticket:943]
2008-02-01 01:16:18 +00:00
Jason Kirtland 7bf0fca858 - Workaround for datetime quirk, LHS comparisons to SA expressions now work. 2008-01-31 21:32:38 +00:00
Jason Kirtland e13fdb965f - implemented RowProxy.__ne__ [ticket:945], thanks knutroy
- test coverage for same
2008-01-31 04:49:31 +00:00
Mike Bayer a5b23bda66 - the startswith(), endswith(), and contains() operators
now concatenate the wildcard operator with the given
operand in SQL, i.e. "'%' || <bindparam>" in all cases,
accept text('something') operands properly [ticket:962]

- cast() accepts text('something') and other non-literal
operands properly [ticket:962]
2008-01-31 03:57:20 +00:00
Mike Bayer 19c3c4c2e0 escapedefaultstest passes on everything 2008-01-30 21:33:17 +00:00
Mike Bayer 2d2042cc2b moved default escaping test to its own test so oracle gets it 2008-01-30 21:31:32 +00:00
Mike Bayer d3e6ccc625 - Oracle and others properly encode SQL used for defaults
like sequences, etc., even if no unicode idents are used
since identifier preparer may return a cached unicode
identifier.
2008-01-30 21:08:11 +00:00
Mike Bayer 74a128c686 more capability added to reduce_columns 2008-01-23 15:16:43 +00:00
Jason Kirtland 342adac637 - Cover 2.3 Decimal fallback 2008-01-22 18:06:46 +00:00
Jason Kirtland 412c80dd6c - 2.3 fixup, part two: 100% passing for sqlite
- added 2.4-style binops to util.Set on 2.3
  - OrderedSets pickle on 2.3
  - more lib/sqlalchemy set vs Set corrections
  - fixed InstrumentedSet.discard for 2.3
  - set, sorted compatibility for test suite
- added testing.fails_if decorator
2008-01-21 23:19:39 +00:00
Mike Bayer bd3a65252d - Oracle assembles the correct columns in the result set
column mapping when generating a LIMIT/OFFSET subquery,
  allows columns to map properly to result sets even
  if long-name truncation kicks in [ticket:941]
2008-01-19 20:11:29 +00:00
Mike Bayer 840a2fabb8 - some expression fixup:
- the '.c.' attribute on a selectable now gets an
entry for every column expression in its columns
clause; previously, "unnamed" columns like functions
and CASE statements weren't getting put there.  Now
they will, using their full string representation
if no 'name' is available.
- The anonymous 'label' generated for otherwise
unlabeled functions and expressions now propagates
outwards at compile time for expressions like
select([select([func.foo()])])
- a CompositeSelect, i.e. any union(), union_all(),
intersect(), etc. now asserts that each selectable
contains the same number of columns.  This conforms
to the corresponding SQL requirement.
- building on the above ideas, CompositeSelects
now build up their ".c." collection based on
the names present in the first selectable only;
corresponding_column() now works fully for all
embedded selectables.
2008-01-19 18:36:52 +00:00
Mike Bayer 9eced72c03 finally, a really straightforward reduce() method which reduces cols
to the minimal set for every test case I can come up with, and
now replaces all the cruft in Mapper._compile_pks() as well as
Join.__init_primary_key().  mappers can now handle aliased selects
and figure out the correct PKs pretty well [ticket:933]
2008-01-15 17:59:27 +00:00
Jason Kirtland 17d3c8764e - testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase
- testing.db has the configured db
- Fixed up the perf/* scripts
2008-01-12 22:03:42 +00:00
Jason Kirtland c194962019 - Undeclared SAWarnings are now fatal to tests as well.
- Fixed typo that was killing runs of individual named tests.
2008-01-12 04:52:05 +00:00
Mike Bayer 05a693fcb7 fixed NOT ILIKE 2008-01-11 21:30:02 +00:00
Mike Bayer 6d2d5e923e - added "ilike()" operator to column operations.
compiles to ILIKE on postgres, lower(x) LIKE lower(y)
on all others [ticket:727]
2008-01-11 21:24:01 +00:00
Jason Kirtland 3e9df22546 Include column name in length-less String warning (more [ticket:912]) 2008-01-10 23:16:56 +00:00
Mike Bayer f1cb136a62 - added a mapper() flag "eager_defaults"; when set to
True, defaults that are generated during an INSERT
or UPDATE operation are post-fetched immediately,
instead of being deferred until later.  This mimics
the old 0.3 behavior.
2008-01-10 22:32:51 +00:00
Jason Kirtland bf36c648f2 Reworked r4042- undeclared deprecation warnings are now *fatal* to tests. No surprises. 2008-01-10 02:37:39 +00:00
Jason Kirtland 84576e3258 test suite deprecation rampage 2008-01-09 22:54:51 +00:00
Jason Kirtland c83bb94e0d Added UnicodeText alias 2008-01-09 20:22:41 +00:00
Mike Bayer eefd1f78a2 redid the _for_ddl String/Text deprecation warning correctly [ticket:912] 2008-01-09 18:09:49 +00:00
Mike Bayer 6eb9c11e7b - fixed bug in union() so that select() statements which don't derive
from FromClause objects can be unioned
2008-01-08 21:53:37 +00:00
Mike Bayer e8feacf1db - fixed an attribute history bug whereby assigning a new collection
to a collection-based attribute which already had pending changes
would generate incorrect history [ticket:922]

- fixed delete-orphan cascade bug whereby setting the same
object twice to a scalar attribute could log it as an orphan
[ticket:925]
- generative select.order_by(None) / group_by(None) was not managing to
reset order by/group by criterion, fixed [ticket:924]
2008-01-07 18:52:02 +00:00