summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
Commit message (Collapse)AuthorAgeFilesLines
* It's the 'kwargs' which are iterable, not 'keys'pr/147Malthe Borch2014-10-301-2/+1
|
* - Fixed bug in single table inheritance where a chain of joinsMike Bayer2014-10-231-4/+2
| | | | | | | | | | | | that included the same single inh entity more than once (normally this should raise an error) could, in some cases depending on what was being joined "from", implicitly alias the second case of the single inh entity, producing a query that "worked". But as this implicit aliasing is not intended in the case of single table inheritance, it didn't really "work" fully and was very misleading, since it wouldn't always appear. fixes #3233
* - Fixed bug where the ON clause for :meth:`.Query.join`,Mike Bayer2014-10-231-2/+5
| | | | | | | and :meth:`.Query.outerjoin` to a single-inheritance subclass using ``of_type()`` would not render the "single table criteria" in the ON clause if the ``from_joinpoint=True`` flag were set. fixes #3232
* - The :meth:`.Query.update` method will now convert string keyMike Bayer2014-10-161-8/+18
| | | | | | | | | | 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
* - clarify documentation on exists() that it is preferred to be in theMike Bayer2014-09-241-0/+13
| | | | WHERE clause. fixes #3212
* - 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
* - enhance ClauseAdapter / ColumnAdapter to have new behaviors with labels.Mike Bayer2014-09-071-4/+1
| | | | | | | | | | | | | | | | | | | | | 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)
* - The :func:`~.expression.column` and :func:`~.expression.table`Mike Bayer2014-09-011-7/+5
| | | | | | | | | | | | | | | | | | | | | 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
|
* - alter the yield_per eager restriction such that joined many-to-one loadsMike Bayer2014-08-301-5/+14
| | | | are still OK, since these should be fine.
* - The :class:`.Query` will raise an exception when :meth:`.Query.yield_per`Mike Bayer2014-08-291-3/+16
| | | | | | | | 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
|
* - 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
* - major refactoring/inlining to loader.instances(), though not reallyMike Bayer2014-08-281-13/+10
| | | | | | | | | | | 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-2/+3
| | | | | | :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-292/+302
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - Fixed a regression from 0.9.0 due to :ticket:`2736` where theMike Bayer2014-07-141-0/+1
| | | | | | | | | :meth:`.Query.select_from` method no longer set up the "from entity" of the :class:`.Query` object correctly, so that subsequent :meth:`.Query.filter_by` or :meth:`.Query.join` calls would fail to check the appropriate "from" entity when searching for attributes by string name. fixes #3083
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - repair the _enable_single_crit method, it was named the sameMike Bayer2014-06-301-3/+4
| | | | | | | | | | | | as the attribute and probably just replaced itself, so that is now _set_enable_single_crit - as a side effect of the main issue fixed here, correct the case in adjust_for_single_inheritance where the same mapper appears more than once in mapper_adapter_map; run through a set() for uniqueness. - Fixed bug in subquery eager loading in conjunction with :func:`.with_polymorphic`, the targeting of entities and columns in the subquery load has been made more accurate with respect to this type of entity and others. Fixes #3106
* - reverse order of columns in sample CTEs as this is a UNION and the cols ↵Mike Bayer2014-04-021-1/+1
| | | | | | | | | | need to line up - alter this in the unit tests as well as these queries were just copied from the tests - remove the included_parts.join(parts) from the core CTE doc (also just copied from the test, where we want to make sure joins don't get screwed up with the CTE) as it doesn't contribute to the query itself fixes #3014
* - Fixes to the newly enhanced boolean coercion in :ticket:`2804` whereMike Bayer2014-04-011-1/+1
| | | | | | | the new rules for "where" and "having" woudn't take effect for the "whereclause" and "having" kw arguments of the :func:`.select` construct, which is also what :class:`.Query` uses so wasn't working in the ORM either. fixes #3013 re: #2804
* - Fixed regression from 0.8.3 as a result of :ticket:`2818`Mike Bayer2014-03-221-1/+8
| | | | | | where :meth:`.Query.exists` wouldn't work on a query that only had a :meth:`.Query.select_from` entry but no other entities. re: #2818 fixes #2995
* - Improved an error message which would occur if a query() were madeMike Bayer2014-03-171-0/+6
| | | | | | | against a non-selectable, such as a :func:`.literal_column`, and then an attempt was made to use :meth:`.Query.join` such that the "left" side would be determined as ``None`` and then fail. This condition is now detected explicitly.
* - correct this to make the intention clearMike Bayer2014-03-131-2/+1
|
* - extensive cross-linking of relationship options with their documentation ↵Mike Bayer2014-02-161-7/+7
| | | | | | sections - convert all paramter references in relationship documentation to :paramref:
* - Fixed bug where :meth:`.Query.get` would fail to consistentlyMike Bayer2014-02-101-4/+11
| | | | | | raise the :class:`.InvalidRequestError` that invokes when called on a query with existing criterion, when the given identity is already present in the identity map. [ticket:2951]
* - Fixed bug in new :class:`.TextAsFrom` construct where :class:`.Column`-Mike Bayer2014-02-021-0/+1
| | | | | | | | | | oriented row lookups were not matching up to the ad-hoc :class:`.ColumnClause` objects that :class:`.TextAsFrom` generates, thereby making it not usable as a target in :meth:`.Query.from_statement`. Also fixed :meth:`.Query.from_statement` mechanics to not mistake a :class:`.TextAsFrom` for a :class:`.Select` construct. This bug is also an 0.9 regression as the :meth:`.Text.columns` method is called to accommodate the :paramref:`.text.typemap` argument. [ticket:2932]
* - remove this leftover commented pdbMike Bayer2014-01-231-5/+0
|
* - Fixed an 0.9 regression where the automatic aliasing applied byMike Bayer2014-01-231-1/+0
| | | | | | | | | | :class:`.Query` and in other situations where selects or joins were aliased (such as joined table inheritance) could fail if a user-defined :class:`.Column` subclass were used in the expression. In this case, the subclass would fail to propagate ORM-specific "annotations" along needed by the adaptation. The "expression annotations" system has been corrected to account for this case. [ticket:2918]
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - Fixed regression where we apparently still create an implicitMike Bayer2014-01-021-4/+20
| | | | | | | | | | alias when saying query(B).join(B.cs), where "C" is a joined inh class; however, this implicit alias was created only considering the immediate left side, and not a longer chain of joins along different joined-inh subclasses of the same base. As long as we're still implicitly aliasing in this case, the behavior is dialed back a bit so that it will alias the right side in a wider variety of cases. [ticket:2903]
* - call it 0.9.0Mike Bayer2013-12-301-2/+2
|
* fix doc targetMike Bayer2013-12-191-1/+1
|
* - add support for specifying tables or entities for "of"Mike Bayer2013-11-281-36/+73
| | | | | - implement Query with_for_update() - rework docs and tests
* - fix up rendering of "of"Mike Bayer2013-11-281-2/+2
| | | | | | - move out tests, dialect specific out of compiler, compiler tests use new API, legacy API tests in test_selecatble - add support for adaptation of ForUpdateArg, alias support in compilers
* - work in progress, will squashMike Bayer2013-11-281-57/+2
|
* Merge branch 'for_update_of' of github.com:mlassnig/sqlalchemy into ↵Mike Bayer2013-11-281-30/+91
|\ | | | | | | for_update_of
| * added LockmodeArgspr/42Mario Lassnig2013-11-281-50/+84
| |
| * added ORM supportMario Lassnig2013-11-141-4/+20
| |
| * add psql FOR UPDATE OF functionalityMario Lassnig2013-11-121-1/+12
| |
* | Merge branch 'master' of github.com:vrajmohan/sqlalchemy into mmMike Bayer2013-11-141-4/+4
|\ \
| * | Fix cross referencespr/44Vraj Mohan2013-11-141-2/+2
| | |
| * | Fix indentation and escape *args and **kwargsVraj Mohan2013-11-131-2/+2
| | |
* | | Fixed bug where usage of new :class:`.Bundle` object would causeMike Bayer2013-11-131-1/+1
|/ / | | | | | | the :attr:`.Query.column_descriptions` attribute to fail.
* | Fix cross referencesVraj Mohan2013-11-121-5/+5
|/
* - Fixed a regression introduced by :ticket:`2818` where the EXISTSMike Bayer2013-10-301-1/+1
| | | | | | query being generated would produce a "columns being replaced" warning for a statement with two same-named columns, as the internal SELECT wouldn't have use_labels set.
* An overhaul of expression handling for special symbols particularlyMike Bayer2013-10-231-2/+3
| | | | | | | | | | with conjunctions, e.g. ``None`` :func:`.expression.null` :func:`.expression.true` :func:`.expression.false`, including consistency in rendering NULL in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_` expressions which contain boolean constants, and rendering of boolean constants and expressions as compared to "1" or "0" for backends that don't feature ``true``/``false`` constants. [ticket:2804]
* - add an option to Bundle single_entity=True to allow for singleMike Bayer2013-10-071-1/+22
| | | | entity returns without otherwise changing much [ticket:2824]
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-061-20/+10
| | | | | | | | | | | | | - The system of loader options has been entirely rearchitected to build upon a much more comprehensive base, the :class:`.Load` object. This base allows any common loader option like :func:`.joinedload`, :func:`.defer`, etc. to be used in a "chained" style for the purpose of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``. The new system supersedes the usage of dot-separated path names, multiple attributes within options, and the usage of ``_all()`` options. - Added a new load option :func:`.orm.load_only`. This allows a series of column names to be specified as loading "only" those attributes, deferring the rest.
* fix entity_zero resolutionMike Bayer2013-10-041-1/+10
|