Commit Graph

1472 Commits

Author SHA1 Message Date
Mike Bayer 334668d904 - added a new "higher level" operator called "of_type()" -
used in join() as well as with any() and has(), qualifies
the subclass which will be used in filter criterion,
e.g.:

query.filter(Company.employees.of_type(Engineer).
  any(Engineer.name=='foo')),

query.join(Company.employees.of_type(Engineer)).
  filter(Engineer.name=='foo')
2008-02-21 01:01:24 +00:00
Mike Bayer f827e3c0b7 - fixed potential generative bug when the same Query was
used to generate multiple Query objects using join().
2008-02-20 17:09:25 +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 3e6e61dbe7 - modernized cascade.py tests
- your cries have been heard:  removing a pending item
from an attribute or collection with delete-orphan
expunges the item from the session; no FlushError is raised.
Note that if you session.save()'ed the pending item
explicitly, the attribute/collection removal still knocks
it out.
2008-02-17 18:13:14 +00:00
Mike Bayer 1aebdb231f get basic compilation working for [ticket:972] 2008-02-17 15:35:30 +00:00
Mike Bayer a3f67fecb2 - any(), has(), contains(), attribute level == and != now
work properly with self-referential relations - the clause
inside the EXISTS is aliased on the "remote" side to
distinguish it from the parent table.
2008-02-17 01:15:43 +00:00
Mike Bayer 14b3a913ac fixing recent schema.py changes to work with oracle 'owner' attribute 2008-02-14 23:41:17 +00:00
Jason Kirtland 90e3532d0c - Made testlib's --unhashable and r3935's set changes play nice
- A bonus overhead reduction for IdentitySet instances
2008-02-14 22:39:42 +00:00
Jason Kirtland c055143ba9 Restore 2.3 compat for the sharding test 2008-02-14 21:47:01 +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 6f9aa3a900 - added expire_all() method to Session. Calls expire()
for all persistent instances.  This is handy in conjunction
with .....

- instances which have been partially or fully expired
will have their expired attributes populated during a regular
Query operation which affects those objects, preventing
a needless second SQL statement for each instance.
2008-02-11 19:22:34 +00:00
Jason Kirtland 645fa5255d - Fixed .get(<int>) of a String PK (exposed by pg 8.3) 2008-02-11 19:14:38 +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 90c572b513 - Table columns and constraints can be overridden on a
an existing table (such as a table that was already
reflected) using the 'useexisting=True' flag, which now
takes into account the arguments passed along with it.
- fixed one element of [ticket:910]
- refactored reflection test
2008-02-10 23:39:09 +00:00
Mike Bayer 1a3dc51993 - lazy loader can now handle a join condition where the "bound"
column (i.e. the one that gets the parent id sent as a bind
parameter) appears more than once in the join condition.
Specifically this allows the common task of a relation()
which contains a parent-correlated subquery, such as "select
only the most recent child item". [ticket:946]
- col_is_part_of_mappings made more strict, seems to be OK
with tests
- memusage will dump out the size list in an assertion fail
2008-02-09 01:48:19 +00:00
Mike Bayer 0b890e1ccd heisenbug in aisle 3
(when db.dispose is called in unitofwork test with sqlite, the first test that runs in memusage grows by two gc'ed objects on every iteration; then the problem vanishes.  doesnt matter what test runs in memusage.  doing a dispose() in memusage solves the problem also.  screwing wiht the mechanics of engine.dispose() only fix it when both the pool.dispose() *and* the pool.ressurect() are disabled.  its just a subtle python/pysqlite bug afaict)
2008-02-09 01:24:01 +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
Paul Johnston 21c2976870 Fix: deletes with schemas on MSSQL 2000 [ticket:967] 2008-02-08 16:48:37 +00:00
Mike Bayer 2999ea9554 test for session close efficiency 2008-02-08 15:45:54 +00:00
Paul Johnston 5049242f3b Fix some mssql unit tests 2008-02-08 13:45:19 +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
Ants Aasma 4506425966 unit-of-work flush didn't close the failed transaction when the session was not in a transaction and commiting the transaction failed. 2008-02-06 17:38:29 +00:00
Jason Kirtland 5320a47a14 - Enabled schema support on SQLite, added the temporary table namespace to table name reflection
- TODO: add sqlite to the standard alternate schema tests. a little tricky, because unlike CREATE SCHEMA, an ATTACH DATABASE won't survive a pool dispose...
2008-02-05 23:31:14 +00:00
Mike Bayer 2b6e2defe5 expire with synonyms [ticket:964] 2008-02-05 19:41:51 +00:00
Jason Kirtland 6d843aeeb2 - Added free-form DDL statements, can be executed standalone or tied to the DDL create/drop lifecycle of Tables and MetaData. [ticket:903]
- Added DDL event hooks, triggers callables before and after create / drop.
2008-02-05 05:46:33 +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 66df4b4958 forcibly clean out _sessions, _mapper_registry at test start to eliminate leftovers from other unit tests (from other test scripts) still stored in memory 2008-02-04 20:35:25 +00:00
Mike Bayer 72184bc814 add some extra assertions to ensure all mappers are gone after clear_mappers() (for [ticket:963]) 2008-02-04 02:44:04 +00:00
Jason Kirtland b79f23d3d0 - fixed reflection of Time columns on sqlite 2008-02-01 08:11:12 +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 3aed5fa544 - Friendlier exception messages for unbound, implicit execution
- Implicit binding failures now raise UnboundExecutionError
2008-01-31 19:48:13 +00:00
Mike Bayer e1aa7573f2 - added "autocommit=True" kwarg to select() and text(),
as well as generative autocommit() method on select();
for statements which modify the database through some
user-defined means other than the usual INSERT/UPDATE/
DELETE etc., this flag will enable "autocommit" behavior
during execution if no transaction is in progress
[ticket:915]
2008-01-31 17:48:22 +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 d2e4c52b9f - next release will be 0.4.3
- fixed merge() collection-doubling bug when merging
transient entities with backref'ed collections.
[ticket:961]
- merge(dont_load=True) does not accept transient
entities, this is in continuation with the fact that
merge(dont_load=True) does not accept any "dirty"
objects either.
2008-01-30 17:35:20 +00:00
Mike Bayer da7fef941c - "Passive defaults" and other "inline" defaults can now
be loaded during a flush() call if needed; in particular,
this allows constructing relations() where a foreign key
column references a server-side-generated, non-primary-key
column. [ticket:954]
2008-01-28 23:15:40 +00:00
Jason Kirtland b5dd96590a - Added a simple @future test marker. 2008-01-28 19:58:39 +00:00
Jason Kirtland 7ed5faff26 - Fixed little think-o in fails_if 2008-01-28 19:52:04 +00:00
Mike Bayer 88f42cf1f4 - Fixed bug in polymorphic inheritance where incorrect
exception is raised when base polymorphic_on
column does not correspond to any columns within
the local selectable of an inheriting mapper more
than one level deep
2008-01-27 02:21:23 +00:00
Mike Bayer 33a6724e33 - added standalone "query" class attribute generated
by a scoped_session.  This provides MyClass.query
without using Session.mapper.  Use via:

MyClass.query = Session.query_property()
2008-01-25 18:16:12 +00:00
Jason Kirtland ed74083956 - Flipped join order of __radd__ on association proxied lists. 2008-01-24 01:12:46 +00:00