summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
Commit message (Collapse)AuthorAgeFilesLines
* - A warning is emitted in the case of multiple relationships thatticket_3230Mike Bayer2014-10-191-0/+51
| | | | | | | | | | | | ultimately will populate a foreign key column in conflict with another, where the relationships are attempting to copy values from different source columns. This occurs in the case where composite foreign keys with overlapping columns are mapped to relationships that each refer to a different referenced column. A new documentation section illustrates the example as well as how to overcome the issue by specifying "foreign" columns specifically on a per-relationship basis. fixes #3230
* - The :meth:`.Query.update` method will now convert string keyMike Bayer2014-10-162-13/+56
| | | | | | | | | | names in the given dictionary of values into mapped attribute names against the mapped class being updated. Previously, string names were taken in directly and passed to the core update statement without any means to resolve against the mapped entity. Support for synonyms and hybrid attributes as the subject attributes of :meth:`.Query.update` are also supported. fixes #3228
* - Improvements to the mechanism used by :class:`.Session` to locateMike Bayer2014-10-141-43/+53
| | | | | | | "binds" (e.g. engines to use), such engines can be associated with mixin classes, concrete subclasses, as well as a wider variety of table metadata such as joined inheritance tables. fixes #3035
* Merge remote-tracking branch 'origin/pr/140' into pr140Mike Bayer2014-10-112-3/+3
|\
| * cleanup exception handling - use new exception hierarchy (since python 2.5)pr/140ndparker2014-10-021-3/+1
| |
| * improve exception vs. exit handlingndparker2014-09-232-2/+4
| |
* | - The ON clause rendered when using :meth:`.Query.join`,Mike Bayer2014-10-091-0/+10
| | | | | | | | | | | | | | | | | | | | :meth:`.Query.outerjoin`, or the standalone :func:`.orm.join` / :func:`.orm.outerjoin` functions to a single-inheritance subclass will now include the "single table criteria" in the ON clause even if the ON clause is otherwise hand-rolled; it is now added to the criteria using AND, the same way as if joining to a single-table target using relationship or similar. fixes #3222
* | - cyclomatic complexity: instrument_class goes from E to an AMike Bayer2014-09-271-11/+37
| |
* | - add explicit warning re: polymorphic_on, cascading is not supportedMike Bayer2014-09-261-0/+6
| | | | | | | | at this time. ref #3214
* | - refactor of declarative, break up into indiviudal methodsMike Bayer2014-09-251-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that are now affixed to _MapperConfig - declarative now creates column copies ahead of time so that they are ready to go for a declared_attr - overhaul of declared_attr; memoization, cascading modifier - A relationship set up with :class:`.declared_attr` on a :class:`.AbstractConcreteBase` base class will now be configured on the abstract base mapping automatically, in addition to being set up on descendant concrete classes as usual. fixes #2670 - The :class:`.declared_attr` construct has newly improved behaviors and features in conjunction with declarative. The decorated function will now have access to the final column copies present on the local mixin when invoked, and will also be invoked exactly once for each mapped class, the returned result being memoized. A new modifier :attr:`.declared_attr.cascading` is added as well. fixes #3150 - the original plan for #3150 has been scaled back; by copying mixin columns up front and memoizing, we don't actually need the "map properties later" thing. - full docs + migration notes
* | - clarify documentation on exists() that it is preferred to be in theMike Bayer2014-09-241-0/+13
|/ | | | WHERE clause. fixes #3212
* - Fixed bug that affected generally the same classes of eventMike Bayer2014-09-181-4/+8
| | | | | | | | | | as that of :ticket:`3199`, when the ``named=True`` parameter would be used. Some events would fail to register, and others would not invoke the event arguments correctly, generally in the case of when an event was "wrapped" for adaption in some other way. The "named" mechanics have been rearranged to not interfere with the argument signature expected by internal wrapper functions. fixes #3197
* - Added new method :meth:`.Select.with_statement_hint` and ORMMike Bayer2014-09-181-2/+27
| | | | | | method :meth:`.Query.with_statement_hint` to support statement-level hints that are not specific to a table. fixes #3206
* - Fixed warning that would emit when a complex self-referentialMike Bayer2014-09-111-4/+4
| | | | | | | primaryjoin contained functions, while at the same time remote_side was specified; the warning would suggest setting "remote side". It now only emits if remote_side isn't present. fixes #3194
* - Fixed bug in ordering list where the order of items would beMike Bayer2014-09-101-0/+10
| | | | | | | | thrown off during a collection replace event, if the reorder_on_append flag were set to True. The fix ensures that the ordering list only impacts the list that is explicitly associated with the object. fixes #3191
* - check for None linker...Mike Bayer2014-09-081-1/+1
|
* - Added new event handlers :meth:`.AttributeEvents.init_collection`Mike Bayer2014-09-073-20/+79
| | | | | | | and :meth:`.AttributeEvents.dispose_collection`, which track when a collection is first associated with an instance and when it is replaced. These handlers supersede the :meth:`.collection.linker` annotation. The old hook remains supported through an event adapter.
* - remove some old cruftMike Bayer2014-09-074-78/+93
| | | | | | - prop.compare() isn't needed; replace with prop._with_parent() for relationships - update docs in orm/interfaces
* - rework ColumnAdapter and ORMAdapter to only provide the featuresticket_3148Mike Bayer2014-09-071-10/+8
| | | | | | | | | | | we're now using; rework them fully so that their behavioral contract is consistent regarding adapter.traverse() vs. adapter.columns[], add a full suite of tests including advanced wrapping scenarios previously only covered by test/orm/test_froms.py and test/orm/inheritance/test_relationships.py - identify several cases where label._order_by_label_clause would be corrupted, e.g. due to adaption or annotation separately - add full tests for #3148
* - enhance ClauseAdapter / ColumnAdapter to have new behaviors with labels.Mike Bayer2014-09-073-9/+10
| | | | | | | | | | | | | | | | | | | | | The "anonymize label" logic is now generalized to ClauseAdapter, and takes place when the anonymize_labels flag is sent, taking effect for all .columns lookups as well as within traverse() calls against the label directly. - traverse() will also memoize what it gets in columns, so that calling upon traverse() / .columns against the same Label will produce the same anonymized label. This is so that AliasedClass produces the same anonymized label when it is accessed per-column (e.g. SomeAlias.some_column) as well as when it is applied to a Query, and within column loader strategies (e.g. query(SomeAlias)); the former uses traverse() while the latter uses .columns - AliasedClass now calls onto ColumnAdapter - Query also makes sure to use that same ColumnAdapter from the AliasedClass in all cases - update the logic from 0.9 in #1068 to make use of the same _label_resolve_dict we use for #2992, simplifying how that works and adding support for new scenarios that were pretty broken (see #3148, #3188)
* wip for #3148Mike Bayer2014-09-062-5/+6
|
* - tiny refactors #1-#5Mike Bayer2014-09-051-3/+3
|
* - The :func:`~.expression.column` and :func:`~.expression.table`Mike Bayer2014-09-012-9/+6
| | | | | | | | | | | | | | | | | | | | | constructs are now importable from the "from sqlalchemy" namespace, just like every other Core construct. - The implicit conversion of strings to :func:`.text` constructs when passed to most builder methods of :func:`.select` as well as :class:`.Query` now emits a warning with just the plain string sent. The textual conversion still proceeds normally, however. The only method that accepts a string without a warning are the "label reference" methods like order_by(), group_by(); these functions will now at compile time attempt to resolve a single string argument to a column or label expression present in the selectable; if none is located, the expression still renders, but you get the warning again. The rationale here is that the implicit conversion from string to text is more unexpected than not these days, and it is better that the user send more direction to the Core / ORM when passing a raw string as to what direction should be taken. Core/ORM tutorials have been updated to go more in depth as to how text is handled. fixes #2992
* - improve from_statement() docMike Bayer2014-08-311-3/+9
|
* - A new style of warning can be emitted which will "filter" up toMike Bayer2014-08-313-11/+10
| | | | | | | | | N occurrences of a parameterized string. This allows parameterized warnings that can refer to their arguments to be delivered a fixed number of times until allowing Python warning filters to squelch them, and prevents memory from growing unbounded within Python's warning registries. fixes #3178
* - alter the yield_per eager restriction such that joined many-to-one loadsMike Bayer2014-08-302-7/+16
| | | | are still OK, since these should be fine.
* - continue moving things out that don't need to be thereMike Bayer2014-08-301-68/+59
| | | | | | - an existing state shouldn't need its load_options/load_path updated; it should maintain those from its original Query source. there's no tests that check this behavior
* - do the polymorphic thing as a decorator so it's out of the way otherwiseMike Bayer2014-08-291-31/+22
|
* - pull out populators back into separate functions, though still very inlinedMike Bayer2014-08-291-82/+114
|
* - further move things vertically, at which point things are inlined enoughMike Bayer2014-08-291-51/+60
| | | | that I'd like to start de-inlining again in the hopes of making this readable.
* - need to use safe_discard() at least in _restore_snapshot(), let's use itMike Bayer2014-08-291-3/+3
| | | | everywhere in Session since the optimized one only applies to loading
* - defaultdict benchmarks faster than a namedtuple; OKMike Bayer2014-08-293-107/+104
| | | | - inline the column-based expiration operations as well
* - reorganize how create_row_processor() communicates up toMike Bayer2014-08-293-82/+84
| | | | | | | | instances(), using a named tuple it can assign to directly. this way we never have to worry about that structure changing anymore, though we are still having it append (key, fn) which is kind of awkward. - inline _populators() into instance(), it's a little verbose but saves an fn call
* - re-establish and test some behavior from previous versions, thatMike Bayer2014-08-291-11/+12
| | | | | | | if a load() or refresh() event changes history (which...why...but anyway) the state of the object is the same; currently it seems that history gets reset but on a refresh, the object still goes into session.dirty - simplify what we store in partials
* - The :class:`.Query` will raise an exception when :meth:`.Query.yield_per`Mike Bayer2014-08-292-3/+20
| | | | | | | | is used with mappings or options where eager loading, either joined or subquery, would take place. These loading strategies are not currently compatible with yield_per, so by raising this error, the method is safer to use - combine with sending False to :meth:`.Query.enable_eagerloads` to disable the eager loaders.
* - add some more docs to yield_perMike Bayer2014-08-291-18/+38
|
* - use a faster discard when loadingMike Bayer2014-08-293-4/+16
| | | | - don't do a bool on identity map since it calls __len__
* - inline the commit of partials tooMike Bayer2014-08-291-3/+3
|
* - Changed the approach by which the "single inheritance criterion"Mike Bayer2014-08-291-1/+1
| | | | | | | | | | is applied, when using :meth:`.Query.from_self`, or its common user :meth:`.Query.count`. The criteria to limit rows to those with a certain type is now indicated on the inside subquery, not the outside one, so that even if the "type" column is not available in the columns clause, we can filter on it on the "inner" query. fixes #3177
* inlines galoreMike Bayer2014-08-291-34/+32
|
* - major refactoring/inlining to loader.instances(), though not reallyMike Bayer2014-08-289-454/+154
| | | | | | | | | | | any speed improvements :(. code is in a much better place to be run into C, however - The ``proc()`` callable passed to the ``create_row_processor()`` method of custom :class:`.Bundle` classes now accepts only a single "row" argument. - Deprecated event hooks removed: ``populate_instance``, ``create_instance``, ``translate_row``, ``append_result`` - the getter() idea is somewhat restored; see ref #3175
* - Made a small adjustment to the mechanics of lazy loading,Mike Bayer2014-08-281-1/+4
| | | | | | | | | | such that it has less chance of interfering with a joinload() in the very rare circumstance that an object points to itself; in this scenario, the object refers to itself while loading its attributes which can cause a mixup between loaders. The use case of "object points to itself" is not fully supported, but the fix also removes some overhead so for now is part of testing. fixes #3145
* - A new implementation for :class:`.KeyedTuple` used by theMike Bayer2014-08-282-5/+10
| | | | | | :class:`.Query` object offers dramatic speed improvements when fetching large numbers of column-oriented rows. fixes #3176
* - The behavior of :paramref:`.joinedload.innerjoin` as well asMike Bayer2014-08-263-20/+48
| | | | | | | :paramref:`.relationship.innerjoin` is now to use "nested" inner joins, that is, right-nested, as the default behavior when an inner join joined eager load is chained to an outer join eager load. fixes #3008
* - The "resurrect" ORM event has been removed. This event hook hadMike Bayer2014-08-252-23/+0
| | | | | | no purpose since the old "mutable attribute" system was removed in 0.8. fixes #3171
* - factor out determination of current version id out ofMike Bayer2014-08-201-55/+55
| | | | _collect_update_commands and _collect_delete_commands
* - simplify PK logic in update for row switchMike Bayer2014-08-192-16/+9
|
* - optimize collection of cols we insert as noneMike Bayer2014-08-182-17/+11
|
* - move out checks for table in mapper._pks_by_tableMike Bayer2014-08-181-16/+32
|
* - further reorganize collect_insert_commands to distinguish betweenMike Bayer2014-08-181-13/+21
| | | | | setting up given values vs. defaults. again trying to shoot for making this of more general use