summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
Commit message (Collapse)AuthorAgeFilesLines
* - 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
* - organize persistence methods in terms of generators,Mike Bayer2014-08-181-93/+94
| | | | | | narrow down argument lists and generator items for each function down to just what each function needs. This will help for them to be of more multipurpose use for bulk operations
* - major simplification of _collect_update_commands. in particular,Mike Bayer2014-08-182-83/+70
| | | | | | we only call upon the history API fully for primary key columns. We also now skip the whole step of looking at PK columns and using any history at all if no net changes are detected on the object.
* - Fixed bug where attribute "set" events or columns withMike Bayer2014-08-172-19/+22
| | | | | | | | ``@validates`` would have events triggered within the flush process, when those columns were the targets of a "fetch and populate" operation, such as an autoincremented primary key, a Python side default, or a server-side default "eagerly" fetched via RETURNING. fixes #3167
* - support dialects w/o sane multi row count againMike Bayer2014-08-161-15/+33
|
* - need list() here for py3kMike Bayer2014-08-161-1/+4
|
* - port the _collect_insert_commands optimizations from ticket_3100Mike Bayer2014-08-152-36/+70
|
* - The :class:`.IdentityMap` exposed from :class:`.Session.identity`Mike Bayer2014-08-151-26/+8
| | | | | | now returns lists for ``items()`` and ``values()`` in Py3K. Early porting to Py3K here had these returning iterators, when they technically should be "iterable views"..for now, lists are OK.
* - UPDATE statements can now be batched within an ORM flushMike Bayer2014-08-141-41/+62
| | | | | | | | | | into more performant executemany() call, similarly to how INSERT statements can be batched; this will be invoked within flush to the degree that subsequent UPDATE statements for the same mapping and table involve the identical columns within the VALUES clause, as well as that no VALUES-level SQL expressions are embedded. - some other inlinings within persistence.py
* pep8Mike Bayer2014-08-141-9/+9
|
* - The ``info`` parameter has been added to the constructor forMike Bayer2014-08-131-2/+17
| | | | | | | | | | | :class:`.SynonymProperty` and :class:`.ComparableProperty`. - The ``info`` parameter has been added as a constructor argument to all schema constructs including :class:`.MetaData`, :class:`.Index`, :class:`.ForeignKey`, :class:`.ForeignKeyConstraint`, :class:`.UniqueConstraint`, :class:`.PrimaryKeyConstraint`, :class:`.CheckConstraint`. fixes #2963
* - The :meth:`.InspectionAttr.info` collection is now moved down toMike Bayer2014-08-132-22/+26
| | | | | | | | :class:`.InspectionAttr`, where in addition to being available on all :class:`.MapperProperty` objects, it is also now available on hybrid properties, association proxies, when accessed via :attr:`.Mapper.all_orm_descriptors`. fixes #2971
* - rename _InspectionAttr to InspectionAttrMike Bayer2014-08-137-17/+17
|
* flake8 cleanupMike Bayer2014-08-132-24/+28
|
* - restore non_updating_cascade to test_manytomany_nonpassive, but alsoMike Bayer2014-07-251-0/+1
| | | | add sane_multi_rowcount requirement, as pg8000 doesn't do "multi" row count.
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-2028-2659/+2867
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - reinstate E123, E125, E128Mike Bayer2014-07-161-103/+146
| | | | - edit strategies.py to conform
* - fully flake8 this fileMike Bayer2014-07-151-234/+233
|
* - Fixed a regression caused by :ticket:`2976` released in 0.9.4 whereMike Bayer2014-07-151-11/+19
| | | | | | | | | | | | | | | | | the "outer join" propagation along a chain of joined eager loads would incorrectly convert an "inner join" along a sibling join path into an outer join as well, when only descendant paths should be receiving the "outer join" propagation; additionally, fixed related issue where "nested" join propagation would take place inappropriately between two sibling join paths. this is accomplished by re-introducing the removed flag "allow_innerjoin", now inverted and named "chained_from_outerjoin". Propagating this flag allows us to know when we have encountered an outerjoin along a load path, without confusing it for state obtained from a sibling path. fixes #3131 ref #2976