summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/loading.py
Commit message (Collapse)AuthorAgeFilesLines
* - test _instance_processor under cythonMike Bayer2015-08-181-334/+2
|
* - merge of ticket_3499 indexed access branchMike Bayer2015-08-171-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The "hashable" flag on special datatypes such as :class:`.postgresql.ARRAY`, :class:`.postgresql.JSON` and :class:`.postgresql.HSTORE` is now set to False, which allows these types to be fetchable in ORM queries that include entities within the row. fixes #3499 - The Postgresql :class:`.postgresql.ARRAY` type now supports multidimensional indexed access, e.g. expressions such as ``somecol[5][6]`` without any need for explicit casts or type coercions, provided that the :paramref:`.postgresql.ARRAY.dimensions` parameter is set to the desired number of dimensions. fixes #3487 - The return type for the :class:`.postgresql.JSON` and :class:`.postgresql.JSONB` when using indexed access has been fixed to work like Postgresql itself, and returns an expression that itself is of type :class:`.postgresql.JSON` or :class:`.postgresql.JSONB`. Previously, the accessor would return :class:`.NullType` which disallowed subsequent JSON-like operators to be used. part of fixes #3503 - The :class:`.postgresql.JSON`, :class:`.postgresql.JSONB` and :class:`.postgresql.HSTORE` datatypes now allow full control over the return type from an indexed textual access operation, either ``column[someindex].astext`` for a JSON type or ``column[someindex]`` for an HSTORE type, via the :paramref:`.postgresql.JSON.astext_type` and :paramref:`.postgresql.HSTORE.text_type` parameters. also part of fixes #3503 - The :attr:`.postgresql.JSON.Comparator.astext` modifier no longer calls upon :meth:`.ColumnElement.cast` implicitly, as PG's JSON/JSONB types allow cross-casting between each other as well. Code that makes use of :meth:`.ColumnElement.cast` on JSON indexed access, e.g. ``col[someindex].cast(Integer)``, will need to be changed to call :attr:`.postgresql.JSON.Comparator.astext` explicitly. This is part of the refactor in references #3503 for consistency in operator use.
* - Fixed 1.0 regression where a "deferred" attribute would not populateMike Bayer2015-06-291-1/+10
| | | | | | | | | | correctly if it were loaded within the "optimized inheritance load", which is a special SELECT emitted in the case of joined table inheritance used to populate expired or unloaded attributes against a joined table without loading the base table. This is related to the fact that SQLA 1.0 no longer guesses about loading deferred columns and must be directed explicitly. fixes #3468
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - squash-merge the final row_proc integration branch. this isMike Bayer2015-03-011-10/+85
| | | | | | | | | | | | | | | a much more modest outcome than what we started with. The work of create_row_processor() for ColumnProperty objects is essentially done at query setup time combined with some lookups in _instance_processor(). - to allow this change for deferred columns, deferred columns no longer search for themselves in the result. If they've been set up as deferred without any explicit directive to undefer them, then this is what was asked for. if we don't do this, then we're stuck with this performance penalty for all deferred columns which in the vast majority of typical use cases (e.g. loading large, legacy tables or tables with many/large very seldom used values) won't be present in the result and won't be accessed at all.
* - Mapped state internals have been reworked to allow for a 50% reductionMike Bayer2015-02-181-4/+4
| | | | | | | | in callcounts specific to the "expiration" of objects, as in the "auto expire" feature of :meth:`.Session.commit` and for :meth:`.Session.expire_all`, as well as in the "cleanup" step which occurs when object states are garbage collected. fixes #3307
* - Fixed bug where if an exception were thrown at the start of aMike Bayer2015-01-051-31/+35
| | | | | | | | | | :class:`.Query` before it fetched results, particularly when row processors can't be formed, the cursor would stay open with results pending and not actually be closed. This is typically only an issue on an interpreter like Pypy where the cursor isn't immediately GC'ed, and can in some circumstances lead to transactions/ locks being open longer than is desirable. fixes #3285
* - A new style of warning can be emitted which will "filter" up toMike Bayer2014-08-311-4/+5
| | | | | | | | | 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
* - 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.
* - defaultdict benchmarks faster than a namedtuple; OKMike Bayer2014-08-291-63/+85
| | | | - inline the column-based expiration operations as well
* - reorganize how create_row_processor() communicates up toMike Bayer2014-08-291-35/+20
| | | | | | | | 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
* - inline the commit of partials tooMike Bayer2014-08-291-3/+3
|
* inlines galoreMike Bayer2014-08-291-34/+32
|
* - major refactoring/inlining to loader.instances(), though not reallyMike Bayer2014-08-281-145/+74
| | | | | | | | | | | 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
* - A new implementation for :class:`.KeyedTuple` used by theMike Bayer2014-08-281-3/+7
| | | | | | :class:`.Query` object offers dramatic speed improvements when fetching large numbers of column-oriented rows. fixes #3176
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-96/+96
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - Adjustment to attribute mechanics concerning when a value isMike Bayer2014-05-291-1/+1
| | | | | | | | | | | | | | implicitly initialized to None via first access; this action, which has always resulted in a population of the attribute, now emits an attribute event just like any other attribute set operation and generates the same kind of history as one. Additionally, many mapper internal operations will no longer implicitly generate these "None" values when various never-set attributes are checked. These are subtle behavioral fixes to attribute mechanics which provide a better solution to the problem of :ticket:`3060`, which also involves recognition of attributes explicitly set to ``None`` vs. attributes that were never set. fixes #3061
* - mark translate_row, create_instance, populate_instance, append_result as ↵Mike Bayer2014-05-231-0/+3
| | | | legacy
* inliningMike Bayer2014-05-191-5/+2
|
* Revert "remove events nobody uses...?"Mike Bayer2014-05-191-4/+60
| | | | This reverts commit 72a09d9e5c54e3ee8b3561da144d8379ce1df747.
* remove events nobody uses...?Mike Bayer2014-05-191-60/+4
|
* - some inlining, speed up identity mapMike Bayer2014-05-191-9/+15
|
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | is currently being supported in addition to nose, and will likely be preferred to nose going forward. The nose plugin system used by SQLAlchemy has been split out so that it works under pytest as well. There are no plans to drop support for nose at the moment and we hope that the test suite itself can continue to remain as agnostic of testing platform as possible. See the file README.unittests.rst for updated information on running tests with pytest. The test plugin system has also been enhanced to support running tests against mutiple database URLs at once, by specifying the ``--db`` and/or ``--dburi`` flags multiple times. This does not run the entire test suite for each database, but instead allows test cases that are specific to certain backends make use of that backend as the test is run. When using pytest as the test runner, the system will also run specific test suites multiple times, once for each database, particularly those tests within the "dialect suite". The plan is that the enhanced system will also be used by Alembic, and allow Alembic to run migration operation tests against multiple backends in one run, including third-party backends not included within Alembic itself. Third party dialects and extensions are also encouraged to standardize on SQLAlchemy's test suite as a basis; see the file README.dialects.rst for background on building out from SQLAlchemy's test platform.
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - repair the "lockmode" functionality of load_on_ident(). slightly problematicMike Bayer2013-11-281-4/+9
| | | | here is that "lockmode" is also public in Session.refresh().
* - add an option to Bundle single_entity=True to allow for singleMike Bayer2013-10-071-2/+3
| | | | entity returns without otherwise changing much [ticket:2824]
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-5/+3
| | | | | | | | | - rework the event system so that event modules load after their targets, dependencies are reversed - create an improved strategy lookup system for the ORM - rework the ORM to have very few import cycles - move out "importlater" to just util.dependency - other tricks to cross-populate modules in as clear a way as possible
* find some more inline imports and move them outMike Bayer2013-08-041-2/+2
|
* A performance fix related to the usage of the :func:`.defer` optionMike Bayer2013-07-131-1/+1
| | | | | | | | | | | | | when loading mapped entities. The function overhead of applying a per-object deferred callable to an instance at load time was significantly higher than that of just loading the data from the row (note that ``defer()`` is meant to reduce DB/network overhead, not necessarily function call count); the function call overhead is now less than that of loading data from the column in all cases. There is also a reduction in the number of "lazy callable" objects created per load from N (total deferred values in the result) to 1 (total number of deferred cols). [ticket:2778]
* - the raw 2to3 runMike Bayer2013-04-271-6/+6
| | | | - went through examples/ and cleaned out excess list() calls
* :meth:`.Query.merge_result` can now load rows from an outer joinMike Bayer2013-01-081-4/+5
| | | | | where an entity may be ``None`` without throwing an error. [ticket:2640]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* - refactor of pathing mechanics, to address #2614, #2617Mike Bayer2012-12-011-9/+6
| | | | | | | | | | | | | | | | | | | - paths now store Mapper + MapperProperty now instead of string key, so that the parent mapper for the property is known, supports same-named properties on multiple subclasses - the Mapper within the path is now always relevant to the property to the right of it. PathRegistry does the translation now, instead of having all the outside users of PathRegistry worry about it, to produce a path that is much more consistent. Paths are now consistent with mappings in all cases. Special logic to get at "with_polymorphic" structures and such added also. - AliasedClass now has two modes, "use_mapper_path" and regular; "use_mapper_path" is for all those situations where we put an AliasedClass in for a plain class internally, and want it to "path" with the plain mapper. - The AliasedInsp is now the first class "entity" for an AliasedClass, and is passed around internally and used as attr._parententity and such. it is the AliasedClass analogue for Mapper.
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-2/+8
|
* - add coverage for merge_result() [ticket:2588]Mike Bayer2012-10-111-1/+2
| | | | - pre-determine keys for the keyed tuples
* - with InstanceState more public, underscore all its methodsMike Bayer2012-07-181-4/+4
| | | | | that change object state as these aren't intended for public use.
* - justify NamedTuple, now called KeyedTupleMike Bayer2012-07-161-1/+1
| | | | - fix this test
* - move load_scalar_attributes out to loading.pyMike Bayer2012-07-141-0/+65
|
* rework imports hereMike Bayer2012-07-031-36/+35
|
* turn commit_all into an iterative methodMike Bayer2012-06-251-3/+5
|
* 2.5 compatMike Bayer2012-06-231-1/+3
|
* - move all of orm to use absolute importsMike Bayer2012-06-231-0/+533
- break out key mechanics of loading objects into new "orm.loading" module, removing implementation details from both mapper.py and query.py. is analogous to persistence.py - some other cleanup and old cruft removal