summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/baked.py
Commit message (Collapse)AuthorAgeFilesLines
* selectin polymorphic loadingMike Bayer2017-06-051-4/+7
| | | | | | | | | | | | | Added a new style of mapper-level inheritance loading "polymorphic selectin". This style of loading emits queries for each subclass in an inheritance hierarchy subsequent to the load of the base object type, using IN to specify the desired primary key values. Fixes: #3948 Change-Id: I59e071c6142354a3f95730046e3dcdfc0e2c4de5
* Add new configuration, inspection for baked queriesMike Bayer2017-05-171-6/+26
| | | | | | | | | | Added new flag :paramref:`.Session.enable_baked_queries` to the :class:`.Session` to allow baked queries to be disabled session-wide, reducing memory use. Also added new :class:`.Bakery` wrapper so that the bakery returned by :paramref:`.BakedQuery.bakery` can be inspected. Change-Id: I5657af7a99d2b24c89d6aee1343f432728e3f807
* - give SelectinLoader its own bakery, dont use mapperMike Bayer2017-05-161-1/+2
| | | | | | | | level cache - include SelectinLoader itself in the cache key, though this is currently not critical Change-Id: I8e4bcd579277fbe53d9c7eca3552a0b8ab9d7a39
* Use baked lazyloading by defaultMike Bayer2017-04-131-109/+50
| | | | | | | | | | | | | The ``lazy="select"`` loader strategy now makes used of the :class:`.BakedQuery` query caching system in all cases. This removes most overhead of generating a :class:`.Query` object and running it into a :func:`.select` and then string SQL statement from the process of lazy-loading related collections and objects. The "baked" lazy loader has also been improved such that it can now cache in most cases where query load options are used. Change-Id: Ic96792fffaa045ae9aa0a4657d6d29235d3efb85 Fixes: #3954
* Add bindparams support for baked Result count() methodMalaclypse The Younger2017-03-301-1/+1
| | | | | | | | | | Added support for bound parameters, e.g. those normally set up via :meth:`.Query.params`, to the :meth:`.baked.Result.count` method. Previously, support for parameters were omitted. Pull request courtesy Pat Deegan. Change-Id: I8c33548cf2a483699767e459731694c8cadebff6 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/350
* Add count(), scalar() to baked queryMike Bayer2017-01-301-1/+35
| | | | | Change-Id: I8af0d7b41ae2df384ce5d0ef274732352d81f376 Fixes: #3897
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Memoize load_path in all cases, run quick populators for path changeMike Bayer2016-10-171-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | Adds a new variant to the "isnew" state within entity loading for isnew=False, but the load path is new. This is to address the use case of an entity appearing in multiple places in the row in a more generalized way than the fixes in [ticket:3431], [ticket:3811] in that loading.py will be able to tell the populator that this row is not "isnew" but is a "new" path for the entity. For the moment, the new information is only being applied to the use of "quick" populators so that simple column loads can take place on top of a deferred loader from elsewhere in the row. As part of this change, state.load_path() will now always be populated with the "path" that was in effect when this state was originally loaded, which for multi-path loads of the same entity is still non-deterministic. Ideally there'd be some kind of "here's all the paths that loaded this state and how" type of data structure though it's not clear if that could be done while maintaining performance. Fixes: #3822 Change-Id: Ib915365353dfcca09e15c24001a8581113b97d5e
* Assemble "don't joinedload other side" rule using query._current_pathMike Bayer2016-10-171-2/+6
| | | | | | | | | Discovered during testing for [ticket:3822], the rule added for [ticket:1495] will fail if the source object has propagated options set up, which add elements to query._current_path. Fixes: #3824 Change-Id: I3d96c96fee5f9b247f739d2136d18681ac61f2fe
* Fix issue with unbaking subqueriesMark Hahnenberg2016-07-121-1/+2
| | | | | | | | | | Fix improper capture of a loop variable inside a lambda during unbaking of subquery eager loaders, which would cause the incorrect query to be invoked. Fixes: #3743 Change-Id: I995110deb8ee2dae8540486729e1ae64578d28fc Pull-request: https://github.com/zzzeek/sqlalchemy/pull/290
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - Fixed bug in baked loader system where the systemwide monkeypatchMike Bayer2015-12-151-1/+2
| | | | | | | | for setting up baked lazy loaders would interfere with other loader strategies that rely on lazy loading as a fallback, e.g. joined and subquery eager loaders, leading to ``IndexError`` exceptions at mapper configuration time. fixes #3612
* - Fixed an issue in baked queries where the .get() method, used eitherMike Bayer2015-11-291-0/+6
| | | | | | | | | directly or within lazy loads, didn't consider the mapper's "get clause" as part of the cache key, causing bound parameter mismatches if the clause got re-generated. This clause is cached by mappers on the fly but in highly concurrent scenarios may be generated more than once when first accessed. fixes #3597
* Remplement Query.one() in terms of .one_or_none()pr/203Eric Siegerman2015-09-281-8/+7
| | | Thanks to Mike Bayer for suggesting a simpler refactoring.
* Fix sqlalchemy.ext.baked.Result.one_or_none() exception messagepr/202Eric Siegerman2015-09-241-1/+1
| | | Also add a couple of missing tests.
* - replicate Query.one_or_none to BakedQueryMike Bayer2015-09-241-0/+20
| | | | - changelog / version note finishing
* - changelog for pr bitbucket:54Mike Bayer2015-06-031-6/+3
| | | | - alter the approach so that the initial callable is working just like add_criteria/with_criteria
* baked: Support initial args for cache keyINADA Naoki2015-06-021-2/+2
| | | | | | | | | | | | When making baked query in classmethod of declarative base, cls should be added in cache key. @as_declarative class Base(object): @classmethod def baked_query(cls): return bakery(lambda: session.query(cls), (cls,))
* - Added a new extension suite :mod:`sqlalchemy.ext.baked`. ThisMike Bayer2015-03-111-0/+499
simple but unusual system allows for a dramatic savings in Python overhead for the construction and processing of orm :class:`.Query` objects, from query construction up through rendering of a string SQL statement. fixes #3054