Commit Graph

1072 Commits

Author SHA1 Message Date
Mike Bayer 2bd3c795cf - Column-entities (i.e. query(Foo.id)) copy their
state more fully when queries are derived from
themselves + a selectable (i.e. from_self(),
union(), etc.), so that join() and such have the
correct state to work from.  [ticket:1853]

- Fixed bug where Query.join() would fail if
querying a non-ORM column then joining without
an on clause when a FROM clause is already
present, now raises a checked exception the
same way it does when the clause is not
present.  [ticket:1853]
2010-07-15 09:59:17 -04:00
Mike Bayer 5cce6bf2a8 - experimenting with pytidy with mods as a textmate plugin along
the path to 78 chars.   eh
2010-07-10 14:50:13 -04:00
Mike Bayer 5f68031d15 - added "expr" to the column descriptions accessor, this is
an expression that matches on identity the original expression
passed to the query.  In particular you can pass it into order_by()
and similar.
2010-07-08 18:17:23 -04:00
Mike Bayer 85651a964c - 78 chars
- Added "column_descriptions" accessor to Query,
returns a list of dictionaries containing
naming/typing information about the entities
the Query will return.  Can be helpful for
building GUIs on top of ORM queries.
2010-07-08 14:13:56 -04:00
Mike Bayer 50176cf290 added an extra check for the correct class when __init__ is called,
to fix the second half of [ticket:1846]
2010-07-08 10:50:13 -04:00
Mike Bayer d559f9fc94 - Improved the check for an "unmapped class",
including the case where the superclass is mapped
but the subclass is not.  Any attempts to access
cls._sa_class_manager.mapper now raise
UnmappedClassError().  [ticket:1142]
2010-07-08 10:16:13 -04:00
Mike Bayer 91ad6902c5 - Removed errant many-to-many load in unitofwork
which triggered unnecessarily on expired/unloaded
collections. This load now takes place only if
passive_updates is False and the parent primary
key has changed, or if passive_deletes is False
and a delete of the parent has occurred.
[ticket:1845]
2010-07-07 12:01:02 -04:00
Mike Bayer 1efc6b9e77 78 chars 2010-07-07 10:20:43 -04:00
Mike Bayer 8548ca8cc5 - add typing/operator converts to Float/Numeric to get Oracle tests going again,
as we have an unusually high level of dependence on SQLA typing now
- force oracle seqs to return integers
2010-07-02 13:55:24 -04:00
Mike Bayer 87f3344881 - Query.join() will check for a call of the
form query.join(target, clause_expression),
i.e. missing the tuple, and raise an informative
error message that this is the wrong calling form.
2010-07-01 20:50:57 -04:00
Mike Bayer 005d045350 - An instance which is moved to "transient", has
an incomplete or missing set of primary key
attributes, and contains expired attributes, will
raise an InvalidRequestError if an expired attribute
is accessed, instead of getting a recursion overflow.

- make_transient() removes all "loader" callables from
the state being made transient, removing any
"expired" state - all unloaded attributes reset back
to undefined, None/empty on access.
2010-06-30 16:12:32 -04:00
Mike Bayer fc7674bcc8 - moved "post update" functionality from _save_obj() into
its own method, which also groups updates into executemanys.
[ticket:1831]
2010-06-18 19:12:52 -04:00
Mike Bayer f272783f27 - cleanup of new post update, changelog 2010-06-18 15:42:01 -04:00
Mike Bayer 23d1f39ca7 add a test for the actual feature, that multiple post updates are batched 2010-06-18 15:11:32 -04:00
Mike Bayer 41cf0a7ac8 this one is actually doing it. removed the cruft we don't need from the old approach.
not sure if one-to-many with elaborate self-refs, etc., but we appear to be
as good as we were before.
2010-06-18 13:31:51 -04:00
Mike Bayer 1baca89084 adds some tests, refines out the m2o approach. 2010-06-18 13:11:19 -04:00
Mike Bayer 0276ec0cd8 - query.order_by() now accepts False, which cancels
any existing order_by() state on the Query, allowing
subsequent generative methods to be called which do
not support ORDER BY.  This is not the same as the
already existing feature of passing None, which
suppresses any existing order_by() settings, including
those configured on the mapper.  False will make it
as though order_by() was never called, while
None is an active setting.
2010-06-17 15:53:07 -04:00
Mike Bayer 89676b2452 add a test for query.order_by(None) 2010-06-17 10:13:23 -04:00
Mike Bayer 27b9b3578d - Can now call make_transient() on an instance that
is referenced by parent objects via many-to-one,
without the parent's foreign key value getting
temporarily set to None - this was a function
of the "detect primary key switch" flush handler.
It now ignores objects that are no longer
in the "persistent" state, and the parent's
foreign key identifier is left unaffected.
2010-06-15 14:04:13 -04:00
Mike Bayer 7a554d5267 - Query.statement, Query.subquery(), etc. now transfer
the values of bind parameters, i.e. those specified
by query.params(), into the resulting SQL expression.
Previously the values would not be transferred
and bind parameters would come out as None.

- Subquery-eager-loading now works with Query objects
which include params(), as well as get() Queries.
2010-06-14 20:07:44 -04:00
Mike Bayer 92599bfec6 - Fixed bug regarding flushes on self-referential
bi-directional many-to-many relationships, where
two objects made to mutually reference each other
in one flush would fail to insert a row for both
sides.  Regression from 0.5. [ticket:1824]
2010-06-13 16:25:26 -04:00
Mike Bayer c57101bf49 - Fixed regression introduced in 0.6.0 unit of work refactor
that broke updates for bi-directional relationship()
with post_update=True. [ticket:1807]
2010-05-21 17:44:56 -04:00
Mike Bayer e352e255a7 - fixed __setstate__ method of CollectionAdapter to not
fail during deserialize where parent InstanceState not
yet unserialized.  [ticket:1802]
2010-05-13 15:36:22 -04:00
Mike Bayer 6ea6673376 - session.merge() will not expire attributes on the returned
instance if that instance is "pending".  [ticket:1789]
2010-05-08 16:09:48 -04:00
Mike Bayer 4c87fb7613 - Fixed regression introduced in 0.6.0 involving improper
history accounting on mutable attributes.  Essentially
reversing r6b2b4fcd4799 and getting it covered.
[ticket:1782]
2010-04-26 16:55:11 -04:00
Mike Bayer d72b327786 - don't switch a delete to a non-delete during rowswitch, fixes [ticket:1772] 2010-04-16 18:35:49 -04:00
Mike Bayer 3bd09e291b when raising about columns not present, include the name of the property it's trying to configure,
to eliminate confusion over attributes not properly placed inside of a relationship().
2010-04-16 17:01:50 -04:00
Mike Bayer 7cfd33d4ef more test adjustments 2010-04-15 01:35:54 -04:00
Mike Bayer 1cf4a745d8 - beef up the --reversetop test option to embed RandomSet throughout the ORM
- with m2m we have to go back to the previous approach of having both sides of
the DP fire off, tracking each pair of objects.   history may not be consistently present
in one side or the other
- this revealed a whole lot of issues with self-referential m2m, which are fixed
2010-04-15 00:13:48 -04:00
Mike Bayer cf65d1e42e check_reverse was failing a not well covered m2m case. 2010-04-10 20:13:51 -04:00
Mike Bayer 44c67fef8c - starting to groom the branch for its inclusion
- one-to-many relationships now maintain a list of positive
parent-child associations within the flush, preventing
previous parents marked as deleted from cascading a
delete or NULL foreign key set on those child objects,
despite the end-user not removing the child from the old
association. [ticket:1764]
- re-established Preprocess as unique on their arguments,
as they were definitely duped in inheritance scenarios
- added a "memo" feature to UOWTransaction which represents the usual
pattern of using the .attributes collection
- added the test case from [ticket:1081] into perf/
2010-04-10 19:21:54 -04:00
Mike Bayer a91ea946c7 fix bug + add coverage to ensure unneeded SaveUpdateAll/DeleteAll plus extra
work doesn't occur during per-state usage
2010-04-09 18:04:18 -04:00
Mike Bayer bb791e9e4b removes some unneeded methods, initial DetectKeySwitch not present unnecessarily 2010-04-09 16:36:58 -04:00
Mike Bayer 27b0832ea8 refined system bywhich dependencyprocessor per-state actions
are established
2010-04-09 13:57:49 -04:00
Mike Bayer 72fb740c22 start adding tests to ensure the size of the uow 2010-04-08 18:52:04 -04:00
Mike Bayer 1f960f44c0 starting to arrange things such that unneeded executors aren't getting
pulled into the unit of work at all.   this involves dancing around lists
of states, seeing if child objects exist, not adding excessive callcounts
while doing that, etc.
2010-04-08 18:21:02 -04:00
Mike Bayer afba8ab659 - added missing coverage for self-referential many-to-many flushes
- some other areas where per-state deps are called and an empty result returned
are still lacking coverage.
2010-04-06 18:28:40 -04:00
Mike Bayer 9df8afc600 - cleanup, factoring, had some heisenbugs. more test coverage
will be needed overall as missing dependency rules lead
to subtle bugs pretty easily
2010-04-06 01:23:54 -04:00
Mike Bayer 4071156acd all tests pass with this version 2010-04-05 23:21:02 -04:00
Mike Bayer c01d35f15d beginning to get post_update working, will need more tests 2010-04-05 21:29:51 -04:00
Mike Bayer f288339e95 looks like most of the issues are because we're losing insert ordering
on cycles.  so lets reintroduce the organize as tree component, which
works here.   still need to make it meaningful by teaching the save/delete state
actions to receive a set of items to match up
2010-04-05 17:24:00 -04:00
Mike Bayer 67b99a7bfa - enabled the DetectKeySwitch, and additionally added that it need
not execute at all when a one-to-many is present on the reverse side.
- OneToMany can establish a state as "listonly" when passive_updates are enabled
and the change is due to key switch.
2010-04-05 14:49:35 -04:00
Mike Bayer f05b5b0bda merge default branch 2010-04-04 10:38:29 -04:00
Mike Bayer dbc582a43f - apparently [ticket:1761] was covered in tests already.
- Usage of version_id_col on a backend that supports
cursor.rowcount for execute() but not executemany() now works
when a delete is issued (already worked for saves, since those
don't use executemany()). For a backend that doesn't support
cursor.rowcount at all, a warning is emitted the same
as with saves.  [ticket:1761]
2010-04-04 10:18:16 -04:00
Mike Bayer 3d3095497b row switch works for post-cycle sorts too...just needed more data in the deps. the pattern here
is more data needed for each tweak.
2010-04-03 19:41:56 -04:00
Mike Bayer e5c64845f0 o2m/m2o pretty much there, minus post update. 2010-04-03 18:05:33 -04:00
Mike Bayer e8d8c999d2 dont create tables here 2010-04-03 14:08:45 -04:00
Mike Bayer e1c47d12bf - The ORM will set the docstring of all generated descriptors
to None by default.  This can be overridden using 'doc'
(or if using Sphinx, attribute docstrings work too).

- Added kw argument 'doc' to all mapper property callables
as well as Column().  Will assemble the string 'doc' as
the '__doc__' attribute on the descriptor.
2010-04-02 17:22:16 -04:00
Mike Bayer 367bc4a9e5 working through cycles tests... 2010-04-01 19:06:35 -04:00
Mike Bayer 62cf9c8f8f many-to-one completed for self-referential 2010-04-01 18:40:11 -04:00