summaryrefslogtreecommitdiff
path: root/test/orm/test_query.py
Commit message (Collapse)AuthorAgeFilesLines
* PEP8 tidy of test/orm/test_query.pyTony Locke2014-07-201-472/+600
|
* pg8000 passing test/orm/test_query.pyTony Locke2014-07-201-3/+3
|
* - 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
* - add some order bysMike Bayer2014-07-141-3/+15
|
* - fix typos in testMike Bayer2014-05-241-2/+2
| | | | - restore __len__ to identity map
* - more tests, including backend testsMike Bayer2014-05-161-7/+19
| | | | - implement for SQL server, use window functions when simple limit/offset not available
* Merge branch 'issue_3034' of ↵Mike Bayer2014-05-161-0/+13
|\ | | | | | | https://bitbucket.org/dobesv/sqlalchemy/branch/issue_3034 into ticket_3034
| * Expand test to also test whether offset accepts a bindparam.Dobes Vandermeer2014-04-241-2/+6
| |
| * Proof-of-concept implementation of supporting bindparam for offset and limit ↵Dobes Vandermeer2014-04-241-0/+9
| | | | | | | | on a query.
* | Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-2/+2
|/ | | | Found using: https://github.com/intgr/topy
* - Fixes to the newly enhanced boolean coercion in :ticket:`2804` whereMike Bayer2014-04-011-1/+55
| | | | | | | 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-0/+11
| | | | | | 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
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - dont need these extra conditions from the previous testMike Bayer2014-02-101-5/+0
|
* - Fixed bug where :meth:`.Query.get` would fail to consistentlyMike Bayer2014-02-101-0/+18
| | | | | | 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]
* - use from_statement() for the ORM column testMike Bayer2014-02-021-8/+7
| | | | - with select_from(), add external order by so that Oracle orders correctly
* - Fixed bug in new :class:`.TextAsFrom` construct where :class:`.Column`-Mike Bayer2014-02-021-1/+38
| | | | | | | | | | 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]
* - Fixed regression whereby the "annotation" system used by the ORM was leakingMike Bayer2014-01-291-0/+14
| | | | | | | into the names used by standard functions in :mod:`sqlalchemy.sql.functions`, such as ``func.coalesce()`` and ``func.max()``. Using these functions in ORM attributes and thus producing annotated versions of them could corrupt the actual function name rendered in the SQL. [ticket:2927]
* - add support for specifying tables or entities for "of"Mike Bayer2013-11-281-0/+1
| | | | | - implement Query with_for_update() - rework docs and tests
* - Some refinements to the :class:`.AliasedClass` construct with regardsMike Bayer2013-11-231-3/+6
| | | | | | | | | | | | | | | to descriptors, like hybrids, synonyms, composites, user-defined descriptors, etc. The attribute adaptation which goes on has been made more robust, such that if a descriptor returns another instrumented attribute, rather than a compound SQL expression element, the operation will still proceed. Addtionally, the "adapted" operator will retain its class; previously, a change in class from ``InstrumentedAttribute`` to ``QueryableAttribute`` (a superclass) would interact with Python's operator system such that an expression like ``aliased(MyClass.x) > MyClass.x`` would reverse itself to read ``myclass.x < myclass_1.x``. The adapted attribute will also refer to the new :class:`.AliasedClass` as its parent which was not always the case before. [ticket:2872]
* - remove informix dialect, moved out to ↵Mike Bayer2013-11-171-1/+0
| | | | | | https://bitbucket.org/zzzeek/sqlalchemy_informixdb - remove informix, maxdb, access symbols from tests etc.
* Fixed bug where usage of new :class:`.Bundle` object would causeMike Bayer2013-11-131-1/+12
| | | | the :attr:`.Query.column_descriptions` attribute to fail.
* - Fixed a regression introduced by :ticket:`2818` where the EXISTSMike Bayer2013-10-301-4/+16
| | | | | | 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.
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-061-581/+0
| | | | | | | | | | | | | - 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.
* Fixed Query.exists() method for the case, when query doesn't have any ↵Vladimir Magamedov2013-09-041-1/+10
| | | | filters applied.
* - Added new method to the :func:`.insert` constructMike Bayer2013-07-051-1/+70
| | | | | | | | | | :meth:`.Insert.from_select`. Given a list of columns and a selectable, renders ``INSERT INTO (table) (columns) SELECT ..``. While this feature is highlighted as part of 0.9 it is also backported to 0.8.3. [ticket:722] - The :func:`.update`, :func:`.insert`, and :func:`.delete` constructs will now interpret ORM entities as FROM clauses to be operated upon, in the same way that select() already does. Also in 0.8.3.
* - rework of correlation, continuing on #2668, #2746Mike Bayer2013-06-261-26/+68
| | | | | | | | | | | | | | | | | | | | | | | | - add support for correlations to propagate all the way in; because correlations require context now, need to make sure a select enclosure of any level takes effect any number of levels deep. - fix what we said correlate_except() was supposed to do when we first released #2668 - "the FROM clause is left intact if the correlated SELECT is not used in the context of an enclosing SELECT..." - it was not considering the "existing_froms" collection at all, and prohibited additional FROMs from being placed in an any() or has(). - add test for multilevel any() - lots of docs, including glossary entries as we really need to define "WHERE clause", "columns clause" etc. so that we can explain correlation better - based on the insight that a SELECT can correlate anything that ultimately came from an enclosing SELECT that links to this one via WHERE/columns/HAVING/ORDER BY, have the compiler keep track of the FROM lists that correspond in this way, link it to the asfrom flag, so that we send to _get_display_froms() the exact list of candidate FROMs to correlate. no longer need any asfrom logic in the Select() itself - preserve 0.8.1's behavior for correlation when no correlate options are given, not to mention 0.7 and prior's behavior of not propagating implicit correlation more than one level.. this is to reduce surprises/hard-to-debug situations when a user isn't trying to correlate anything.
* remove all remaining start/end py2k/py3k blocksMike Bayer2013-06-071-20/+12
|
* - the raw 2to3 runMike Bayer2013-04-271-41/+42
| | | | - went through examples/ and cleaned out excess list() calls
* adding convenience method exists() to Query (see # 2673)Diana Clarke2013-03-291-0/+15
|
* - clean up entity correlation tests in test_queryMike Bayer2013-03-091-12/+17
|
* Changed behavior of Select.correlate() to ignore correlations to froms that ↵Luke Cyca2013-03-071-9/+15
| | | | don't exist in the superquery.
* Fixed bug whereby :meth:`.Query.yield_per` would set the executionMike Bayer2013-02-081-0/+11
| | | | | | options incorrectly, thereby breaking subsequent usage of the :meth:`.Query.execution_options` method. Courtesy Ryan Kelly. [ticket:2661]
* - adding in requirementsMike Bayer2013-02-061-8/+15
| | | | - get test_naturalpks to be more generalized
* - refactor of pathing mechanics, to address #2614, #2617Mike Bayer2012-12-011-17/+28
| | | | | | | | | | | | | | | | | | | - 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.
* Fixed bug in type_coerce() whereby typing informationMike Bayer2012-11-121-2/+3
| | | | | | | | could be lost if the statement were used as a subquery inside of another statement, as well as other similar situations. Among other things, would cause typing information to be lost when the Oracle/mssql dialects would apply limit/offset wrappings. [ticket:2603]
* - [feature] The Query can now load entity/scalar-mixedMike Bayer2012-10-151-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | "tuple" rows that contain types which aren't hashable, by setting the flag "hashable=False" on the corresponding TypeEngine object in use. Custom types that return unhashable types (typically lists) can set this flag to False. [ticket:2592] - [bug] Applying a column expression to a select statement using a label with or without other modifying constructs will no longer "target" that expression to the underlying Column; this affects ORM operations that rely upon Column targeting in order to retrieve results. That is, a query like query(User.id, User.id.label('foo')) will now track the value of each "User.id" expression separately instead of munging them together. It is not expected that any users will be impacted by this; however, a usage that uses select() in conjunction with query.from_statement() and attempts to load fully composed ORM entities may not function as expected if the select() named Column objects with arbitrary .label() names, as these will no longer target to the Column objects mapped by that entity. [ticket:2591]
* - allow a __clause_element__() to be passed to query.filter() alsoMike Bayer2012-10-151-0/+9
|
* - [feature] "scalar" selects now have a WHERE methodMike Bayer2012-10-151-0/+20
| | | | | | | | | | | | | | | | | | | | to help with generative building. Also slight adjustment regarding how SS "correlates" columns; the new methodology no longer applies meaning to the underlying Table column being selected. This improves some fairly esoteric situations, and the logic that was there didn't seem to have any purpose. - [feature] Some support for auto-rendering of a relationship join condition based on the mapped attribute, with usage of core SQL constructs. E.g. select([SomeClass]).where(SomeClass.somerelationship) would render SELECT from "someclass" and use the primaryjoin of "somerelationship" as the WHERE clause. This changes the previous meaning of "SomeClass.somerelationship" when used in a core SQL context; previously, it would "resolve" to the parent selectable, which wasn't generally useful. Related to [ticket:2245].
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-7/+6
| | | | | | | become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
* - got firebird runningMike Bayer2012-09-231-11/+1
| | | | | | | | | | | | - add some failure cases - [bug] Firebird now uses strict "ansi bind rules" so that bound parameters don't render in the columns clause of a statement - they render literally instead. - [bug] Support for passing datetime as date when using the DateTime type with Firebird; other dialects support this.
* - [bug] Fixed a regression since 0.6 regardingMike Bayer2012-08-311-9/+49
| | | | | | | | | | | | | | | | result-row targeting. It should be possible to use a select() statement with string based columns in it, that is select(['id', 'name']).select_from('mytable'), and have this statement be targetable by Column objects with those names; this is the mechanism by which query(MyClass).from_statement(some_statement) works. At some point the specific case of using select(['id']), which is equivalent to select([literal_column('id')]), stopped working here, so this has been re-instated and of course tested. [ticket:2558]
* - [feature] The "required" flag is set toMike Bayer2012-08-271-2/+4
| | | | | | | | | | True by default, if not passed explicitly, on bindparam() if the "value" or "callable" parameters are not passed. This will cause statement execution to check for the parameter being present in the final collection of bound parameters, rather than implicitly assigning None. [ticket:2556]
* - adjustments for py3.3 unit tests, [ticket:2542]Mike Bayer2012-08-111-17/+0
|
* - [feature] Added reduce_columns() methodMike Bayer2012-07-281-0/+17
| | | | | | | | | | | | | | | to select() construct, replaces columns inline using the util.reduce_columns utility function to remove equivalent columns. reduce_columns() also adds "with_only_synonyms" to limit the reduction just to those columns which have the same name. The deprecated fold_equivalents() feature is removed [ticket:1729]. - [feature] Added with_labels and reduce_columns keyword arguments to Query.subquery(), to provide two alternate strategies for producing queries with uniquely- named columns. [ticket:1729].
* - some more interpret_as_fromsMike Bayer2012-07-231-0/+18
|
* - [feature] ORM entities can be passedMike Bayer2012-07-231-0/+74
| | | | | | | to select() as well as the select_from(), correlate(), and correlate_except() methods, where they will be unwrapped into selectables. [ticket:2245]
* - with InstanceState more public, underscore all its methodsMike Bayer2012-07-181-61/+61
| | | | | that change object state as these aren't intended for public use.
* - [feature] The of_type() construct on attributesMike Bayer2012-06-201-43/+47
| | | | | | | | | | | | | | | | | | | | | | | | now accepts aliased() class constructs as well as with_polymorphic constructs, and works with query.join(), any(), has(), and also eager loaders subqueryload(), joinedload(), contains_eager() [ticket:2438] [ticket:1106] - a rewrite of the query path system to use an object based approach for more succinct usage. the system has been designed carefully to not add an excessive method overhead. - [feature] select() features a correlate_except() method, auto correlates all selectables except those passed. Is needed here for the updated any()/has() functionality. - remove some old cruft from LoaderStrategy, init(),debug_callable() - use a namedtuple for _extended_entity_info. This method should become standard within the orm internals - some tweaks to the memory profile tests, number of runs can be customized to work around pysqlite's very annoying behavior - try to simplify PropertyOption._get_paths(), rename to _process_paths(), returns a single list now. overall works more completely as was needed for of_type() functionality
* - [bug] Fixed bug in relationship comparisonsMike Bayer2012-04-251-0/+10
| | | | | | | whereby calling unimplemented methods like SomeClass.somerelationship.like() would produce a recursion overflow, instead of NotImplementedError.