Commit Graph

644 Commits

Author SHA1 Message Date
Mike Bayer 29d4335b73 - Fixed @on_reconsitute hook for subclasses
which inherit from a base class.
[ticket:1129]
2008-08-08 05:13:23 +00:00
Mike Bayer 2829092cb8 - Improved the determination of the FROM clause
when placing SQL expressions in the query()
list of entities.  In particular scalar subqueries
should not "leak" their inner FROM objects out
into the enclosing query.
2008-08-06 20:58:48 +00:00
Mike Bayer 4cd1902796 - The RowTuple object returned by Query(*cols) now
features keynames which prefer mapped attribute
names over column keys, column keys over
column names, i.e.
Query(Class.foo, Class.bar) will have names
"foo" and "bar" even if those are not the names
of the underlying Column objects.  Direct
Column objects such as Query(table.c.col) will
return the "key" attribute of the Column.
2008-08-05 20:15:28 +00:00
Mike Bayer d371637af0 - fixed endless loop bug which could occur
within a mapper's deferred load of
inherited attributes.
- declarative initialization of Columns adjusted so that
non-renamed columns initialize in the same way as a non
declarative mapper.   This allows an inheriting mapper
to set up its same-named "id" columns in particular
such that the parent "id" column is favored over the child
column, reducing database round trips when this value
is requested.
2008-08-04 15:21:29 +00:00
Mike Bayer 4769ea895b - renamed autoexpire to expire_on_commit
- renamed SessionTransaction autoflush to reentrant_flush to more clearly state its purpose
- added _enable_transaction_accounting, flag for Mike Bernson which disables the whole 0.5 transaction state management; the system depends on expiry on rollback in order to function.
2008-08-03 18:03:57 +00:00
Mike Bayer d28ba32271 - The "entity_name" feature of SQLAlchemy mappers
has been removed.  For rationale, see
http://groups.google.com/group/sqlalchemy/browse_thread/thread/9e23a0641a88b96d?hl=en
2008-08-02 22:21:42 +00:00
Mike Bayer c7eeea8a95 further refinement to the inheritance "descriptor" detection such that
local columns will still override superclass descriptors.
2008-08-01 17:13:31 +00:00
Mike Bayer 5d55eac6b6 test case to disprove [ticket:1126] 2008-08-01 15:10:36 +00:00
Mike Bayer 86126c98a2 - Fixed bug whereby the "unsaved, pending instance"
FlushError raised for a pending orphan would not take
superclass mappers into account when generating
the list of relations responsible for the error.
2008-07-31 16:41:41 +00:00
Michael Trier c622a86286 Raised an error when sqlite version does not support default values. Addresses #909 in a purposeful way. 2008-07-29 03:08:38 +00:00
Mike Bayer e411a83783 added dummy column to correct results on sqlite 2008-07-26 21:40:36 +00:00
Mike Bayer cfb9bbde7d allow SQLA-defaults on table columns that are excluded in the mapper 2008-07-22 13:45:29 +00:00
Mike Bayer 59b25a513a - more accurate changelog message
- generalized the descriptor detection to any object with a __get__ attribute
2008-07-20 18:36:44 +00:00
Mike Bayer 419753f59b - An inheriting class can now override an attribute
inherited from the base class with a plain descriptor,
or exclude an inherited attribute via the
include_properties/exclude_properties collections.
2008-07-20 18:23:44 +00:00
Mike Bayer a4781e4d76 - A critical fix to dynamic relations allows the
"modified" history to be properly cleared after
a flush().
2008-07-19 21:33:58 +00:00
Mike Bayer e78d06a4db - reverted r4955, that was wrong. The backref responsible for the operation is the one where the "cascade" option should take effect.
- can use None as a value for cascade.
- documented cascade options in docstring, [ticket:1064]
2008-07-19 18:18:50 +00:00
Mike Bayer 100c17229f - save-update and delete-orphan cascade event handler
now considers the cascade rules of the event initiator only, not the local
attribute.  This way the cascade of the initiator controls the behavior
regardless of backref events.
2008-07-18 22:11:22 +00:00
Mike Bayer 5e7f90a1d6 - Fixed a series of potential race conditions in
Session whereby asynchronous GC could remove unmodified,
no longer referenced items from the session as they were
present in a list of items to be processed, typically
during session.expunge_all() and dependent methods.
2008-07-18 17:42:11 +00:00
Mike Bayer 5af88c5df1 - MapperProperty gets its .key attribute assigned early, in _compile_property.
MapperProperty compilation is detected using a "_compiled" flag.
- A mapper which inherits from another, when inheriting
the columns of its inherited mapper, will use any
reassigned property names specified in that inheriting
mapper.  Previously, if "Base" had reassigned "base_id"
to the name "id", "SubBase(Base)" would still get
an attribute called "base_id".   This could be worked
around by explicitly stating the column in each
submapper as well but this is fairly unworkable
and also impossible when using declarative [ticket:1111].
2008-07-16 21:56:23 +00:00
Mike Bayer 0d9985588b added a new test illustrating a particular inheritance bug. will add ticket 2008-07-16 21:23:17 +00:00
Jason Kirtland b155b60280 - Spiffed up the deprecated decorators & @flipped 'em up top 2008-07-16 17:34:41 +00:00
Jason Kirtland 8fa48edbf9 - Removed 2.3 set emulations/enhancements.
(sets.Set-based collections & DB-API returns still work.)
2008-07-15 19:23:52 +00:00
Jason Kirtland 4fe4127958 - Fixed a couple lingering exceptions->exc usages
- Some import tidying
2008-07-15 16:39:27 +00:00
Mike Bayer af38982273 - Added a new SessionExtension hook called after_attach().
This is called at the point of attachment for objects
via add(), add_all(), delete(), and merge().
2008-07-15 14:54:37 +00:00
Mike Bayer 44aa875212 - The "allow_column_override" flag from mapper() has
been removed.  This flag is virtually always misunderstood.
Its specific functionality is available via the
include_properties/exclude_properties mapper arguments.
2008-07-14 20:04:35 +00:00
Mike Bayer 472215eef2 added a passing test for [ticket:1105] 2008-07-14 00:17:04 +00:00
Mike Bayer 0f42004dee - session.refresh() raises an informative error message if
the list of attributes does not include any column-based
attributes.

- query() raises an informative error message if no columns
or mappers are specified.

- lazy loaders now trigger autoflush before proceeding.  This
allows expire() of a collection or scalar relation to
function properly in the context of autoflush.

- whitespace fix to new Table prefixes option
2008-07-05 20:37:44 +00:00
Mike Bayer cf9edea203 commented out bus erroring section for now pending [ticket:1099] resolution 2008-07-05 20:35:26 +00:00
Ants Aasma c571fd6f8a Ugh, learning to use git-svn, [4884] was not supposed to go upstream. Reverting. 2008-07-01 17:00:51 +00:00
Ants Aasma c33e7c7bfa query update and delete need to autoflush 2008-07-01 16:51:14 +00:00
Mike Bayer 4095056a01 removed fairly pointless test which relied on PK generation artifacts 2008-06-30 05:09:04 +00:00
Mike Bayer 8755dc3d66 - fixed up vertical.py
- Fixed query.join() when used in conjunction with a
columns-only clause and an SQL-expression
ON clause in the join.
2008-06-28 15:23:08 +00:00
Gaëtan de Menten d0c243711b session.Query().iterate_instances() has been renamed to just instances(). The old instances() method returning a list instead of an iterator no longer
exists. If you were relying on that behavior, you should use `list(your_query.instances())`.
2008-06-25 15:55:49 +00:00
Mike Bayer 22fcee0e07 - Repaired __str__() method on Query. [ticket:1066] 2008-06-24 19:27:32 +00:00
Mike Bayer 3e8b095178 - Fixed explicit, self-referential joins between two
joined-table inheritance mappers when using
query.join(cls, aliased=True).  [ticket:1082]
2008-06-22 19:02:19 +00:00
Mike Bayer be2d349ade - fixed some concrete inheritance ramifications regarding r4866
- added explicit test coverage for r4866 with joined table inheritance
2008-06-21 18:08:34 +00:00
Mike Bayer c5e2d673a9 - implemented [ticket:887], refresh readonly props upon save
- moved up "eager_defaults" active refresh step (this is an option used by just one user pretty much)
to be per-instance instead of per-table
- fixed table defs from previous deferred attributes enhancement
- CompositeColumnLoader equality comparison fixed for a/b == None; I suspect the composite capability in SA
needs a lot more work than this
2008-06-21 17:23:14 +00:00
Mike Bayer 060c3ce33c - In addition to expired attributes, deferred attributes
also load if their data is present in the result set
[ticket:870]
2008-06-21 16:08:04 +00:00
Mike Bayer c1363d8aca - Added is_active flag to Sessions to detect when
a transaction is in progress [ticket:976].  This
flag is always True with a "transactional"
(in 0.5 a non-"autocommit") Session.
2008-06-17 20:52:11 +00:00
Jason Kirtland c8de80f4ea - Don't insist on locals() mutability [ticket:1073] 2008-06-12 20:09:02 +00:00
Mike Bayer 3cd10102e4 - Query.UpdateDeleteTest.test_delete_fallback fails on mysql due to subquery in DELETE; not sure how to do this exact operation in MySQL
- added query_cls keyword argument to sessionmaker(); allows user-defined Query subclasses to be generated by query().
- added @attributes.on_reconstitute decorator, MapperExtension.on_reconstitute, both receieve 'on_load' attribute event allowing
non-__init__ dependent instance initialization routines.
- push memusage to the top to avoid pointless heisenbugs
- renamed '_foostate'/'_fooclass_manager' to '_sa_instance_state'/'_sa_class_manager'
- removed legacy instance ORM state accessors
- query._get() will use _remove_newly_deleted instead of expunge() on ObjectDeleted, so that transaction rollback
restores the previous state
- removed MapperExtension.get(); replaced by a user-defined Query subclass
- removed needless **kwargs from query.get()
- removed Session.get(cls, id); this is redundant against Session.query(cls).get(id)
- removed Query.load() and Session.load(); the use case for this method has never been clear, and the same functionality is available in more explicit ways
2008-06-09 01:24:08 +00:00
Mike Bayer cde133c45d merged merge fix from r4834/rel_0_4 branch 2008-06-03 14:33:08 +00:00
Mike Bayer e525aee015 - removed query.min()/max()/sum()/avg(). these should be called using column arguments or values in conjunction with func.
- fixed [ticket:1008], count() works with single table inheritance
- changed the relationship of InstrumentedAttribute to class such that each subclass in an inheritance hierarchy gets a unique InstrumentedAttribute per column-oriented attribute, including for the same underlying ColumnProperty.  This allows expressions from subclasses to be annotated accurately so that Query can get a hold of the exact entities to be queried when using column-based expressions.  This repairs various polymorphic scenarios with both single and joined table inheritance.
- still to be determined is what does something like query(Person.name, Engineer.engineer_info) do; currently it's problematic.  Even trickier is query(Person.name, Engineer.engineer_info, Manager.manager_name)
2008-06-02 03:07:12 +00:00
Mike Bayer e3e1535720 merged r4829 of rel_0_4, [ticket:1058] 2008-06-01 14:15:41 +00:00
Mike Bayer 59c1887945 - improved the attribute and state accounting performed by query.update() and query.delete()
- added autoflush support to same
2008-05-29 14:45:40 +00:00
Jason Kirtland ff7574ffa3 - Lengthless String type 2008-05-29 02:42:58 +00:00
Ants Aasma 87718fa82b Add delete and update methods to query 2008-05-29 02:12:17 +00:00
Ants Aasma 77c308367f Preliminary implementation for the evaluation framework 2008-05-29 02:11:49 +00:00
Mike Bayer ae9297bd18 a comment indicating why we can't raise an error for relation(Foo, uselist=False, order_by=something) 2008-05-26 18:35:24 +00:00
Mike Bayer 6510bfbcf7 - PropertyLoader.foreign_keys becomes private
- removed most __foo() defs from properties.py
- complexity reduction in PropertyLoader.do_init()
2008-05-24 18:53:57 +00:00