summaryrefslogtreecommitdiff
path: root/test/orm
Commit message (Collapse)AuthorAgeFilesLines
* - use new Or() directive to test for both SQL variants here, which can varyMike Bayer2014-06-211-7/+16
| | | | based on hash ordering of the ClassManager
* - Additional checks have been added for the case where an inheritingMike Bayer2014-06-208-68/+110
| | | | | | | | | | mapper is implicitly combining one of its column-based attributes with that of the parent, where those columns normally don't necessarily share the same value. This is an extension of an existing check that was added via :ticket:`1892`; however this new check emits only a warning, instead of an exception, to allow for applications that may be relying upon the existing behavior. fixes #3042
* - Modified the behavior of :func:`.orm.load_only` such that primary keyMike Bayer2014-06-121-5/+36
| | | | | | | | | columns are always added to the list of columns to be "undeferred"; otherwise, the ORM can't load the row's identity. Apparently, one can defer the mapped primary keys and the ORM will fail, that hasn't been changed. But as load_only is essentially saying "defer all but X", it's more critical that PK cols not be part of this deferral. fixes #3080
* - Related to :ticket:`3060`, an adjustment has been made to the unitMike Bayer2014-05-301-13/+6
| | | | | | | | | | of work such that loading for related many-to-one objects is slightly more aggressive, in the case of a graph of self-referential objects that are to be deleted; the load of related objects is to help determine the correct order for deletion if passive_deletes is not set. - revert the changes to test_delete_unloaded_m2o, these deletes do in fact need to occur in the order of the two child objects first.
* - add a new assertsql construct "Or", so that we can test for a UOW flushMike Bayer2014-05-301-9/+18
| | | | | | that might take one of multiple directions; apply this to test_delete_unloaded_m2o which is now illustrating multiple paths due to #3060/#3061, though still doing the right thing.
* - Adjustment to attribute mechanics concerning when a value isMike Bayer2014-05-291-6/+72
| | | | | | | | | | | | | | 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
* - Fixed a few edge cases which arise in the so-called "row switch"Mike Bayer2014-05-282-1/+127
| | | | | | | | | | | scenario, where an INSERT/DELETE can be turned into an UPDATE. In this situation, a many-to-one relationship set to None, or in some cases a scalar attribute set to None, may not be detected as a net change in value, and therefore the UPDATE would not reset what was on the previous row. This is due to some as-yet unresovled side effects of the way attribute history works in terms of implicitly assuming None isn't really a "change" for a previously un-set attribute. See also :ticket:`3061`. fixes #3060
* - Fixed bug in subquery eager loading where a long chain ofMike Bayer2014-05-252-1/+112
| | | | | | | eager loads across a polymorphic-subclass boundary in conjunction with polymorphic loading would fail to locate the subclass-link in the chain, erroring out with a missing property name on an :class:`.AliasedClass`. fixes #3055
* - 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.
* | - Fixed ORM bug where the :func:`.class_mapper` function would maskMike Bayer2014-05-101-0/+35
| | | | | | | | | | | | | | AttributeErrors or KeyErrors that should raise during mapper configuration due to user errors. The catch for attribute/keyerror has been made more specific to not include the configuration step. fixes #3047
* | Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-2615-26/+26
|/ | | | Found using: https://github.com/intgr/topy
* - The "primaryjoin" model has been stretched a bit further to allowMike Bayer2014-04-192-2/+199
| | | | | | | | | | a join condition that is strictly from a single column to itself, translated through some kind of SQL function or expression. This is kind of experimental, but the first proof of concept is a "materialized path" join condition where a path string is compared to itself using "like". The :meth:`.Operators.like` operator has also been added to the list of valid operators to use in a primaryjoin condition. fixes #3029
* - Added new utility function :func:`.make_transient_to_detached` which canMike Bayer2014-04-091-1/+46
| | | | | | | be used to manufacture objects that behave as though they were loaded from a session, then detached. Attributes that aren't present are marked as expired, and the object can be added to a Session where it will act like a persistent one. fix #3017
* - 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
* dont need rowcount here...Mike Bayer2014-03-281-1/+0
|
* - Added new parameter :paramref:`.mapper.confirm_deleted_rows`. DefaultsMike Bayer2014-03-282-12/+25
| | | | | | | | | | | | to True, indicates that a series of DELETE statements should confirm that the cursor rowcount matches the number of primary keys that should have matched; this behavior had been taken off in most cases (except when version_id is used) to support the unusual edge case of self-referential ON DELETE CASCADE; to accomodate this, the message is now just a warning, not an exception, and the flag can be used to indicate a mapping that expects self-refererntial cascaded deletes of this nature. See also :ticket:`2403` for background on the original change. re: #2403 fix #3007
* - revert part of c01558ae7f4a for now as we also test that a DELETE of two rowsMike Bayer2014-03-282-7/+11
| | | | | | where one is to be deleted from ON DELETE CASCADE succeeds; the check here makes that fail. We will need to add an option to enable/disable this check per mapping, will likely do this in next version
* - Fixed ORM bug where changing the primary key of an object, then markingMike Bayer2014-03-282-22/+102
| | | | | | | | | | | | | it for DELETE would fail to target the correct row for DELETE. Then to compound matters, basic "number of rows matched" checks were not being performed. Both issues are fixed, however note that the "rows matched" check requires so-called "sane multi-row count" functionality; the DBAPI's executemany() method must count up the rows matched by individual statements and SQLAlchemy's dialect must mark this feature as supported, currently applies to some mysql dialects, psycopg2, sqlite only. fixes #3006 - Enabled "sane multi-row count" checking for the psycopg2 DBAPI, as this seems to be supported as of psycopg2 2.0.9.
* - Fixed a very old behavior where the lazy load emitted for a one-to-manyMike Bayer2014-03-272-3/+161
| | | | | | | | | | | | | | | | | could inappropriately pull in the parent table, and also return results inconsistent based on what's in the parent table, when the primaryjoin includes some kind of discriminator against the parent table, such as ``and_(parent.id == child.parent_id, parent.deleted == False)``. While this primaryjoin doesn't make that much sense for a one-to-many, it is slightly more common when applied to the many-to-one side, and the one-to-many comes as a result of a backref. Loading rows from ``child`` in this case would keep ``parent.deleted == False`` as is within the query, thereby yanking it into the FROM clause and doing a cartesian product. The new behavior will now substitute the value of the local "parent.deleted" for that parameter as is appropriate. Though typically, a real-world app probably wants to use a different primaryjoin for the o2m side in any case. fixes #2948
* - Improved the check for "how to join from A to B" such that whenMike Bayer2014-03-271-0/+37
| | | | | | | | | a table has multiple, composite foreign keys targeting a parent table, the :paramref:`.relationship.foreign_keys` argument will be properly interpreted in order to resolve the ambiguity; previously this condition would raise that there were multiple FK paths when in fact the foreign_keys argument should be establishing which one is expected. fixes #2965
* - add some more rules to make sure all tests run if DBs are availableMike Bayer2014-03-243-6/+7
|
* - fix the uuid routine here to not run out of uuidsMike Bayer2014-03-242-24/+2
|
* - rename __multiple__ to __backend__, and apply __backend__ to a large ↵Mike Bayer2014-03-245-0/+42
| | | | | | number of tests. - move out logging tests from test_execute to test_logging
* - 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
* - Fixed a few errant ``u''`` strings that would prevent tests from passingMike Bayer2014-03-222-8/+8
| | | | in Py3.2. Patch courtesy Arfrever Frehtes Taifersar Arahesis. fixes #2980
* fix assertionMike Bayer2014-03-191-1/+1
|
* - Fixed bug in mutable extension as well asMike Bayer2014-03-191-0/+15
| | | | | | :func:`.attributes.flag_modified` where the change event would not be propagated if the attribute had been reassigned to itself. fixes #2997
* - Improved an error message which would occur if a query() were madeMike Bayer2014-03-171-0/+13
| | | | | | | 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.
* - Added support for the not-quite-yet-documented ``insert=True``Mike Bayer2014-03-161-1/+53
| | | | flag for :func:`.event.listen` to work with mapper / instance events.
* - A warning is emitted if the :meth:`.MapperEvents.before_configured`Mike Bayer2014-03-111-0/+36
| | | | | | or :meth:`.MapperEvents.after_configured` events are applied to a specific mapper or mapped class, as the events are only invoked for the :class:`.Mapper` target at the general level.
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-033-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - Fixed some test/feature failures occurring in Python 3.4,Mike Bayer2014-03-021-20/+0
| | | | | | in particular the logic used to wrap "column default" callables wouldn't work properly for Python built-ins. fixes #2979
* - Added a new option to :paramref:`.relationship.innerjoin` which isMike Bayer2014-02-281-5/+174
| | | | | | | | | | | to specify the string ``"nested"``. When set to ``"nested"`` as opposed to ``True``, the "chaining" of joins will parenthesize the inner join on the right side of an existing outer join, instead of chaining as a string of outer joins. This possibly should have been the default behavior when 0.9 was released, as we introduced the feature of right-nested joins in the ORM, however we are keeping it as a non-default for now to avoid further surprises. fixes #2976
* - Fixed regression from 0.8 where using an option likeMike Bayer2014-02-241-0/+14
| | | | | | | :func:`.orm.lazyload` with the "wildcard" expression, e.g. ``"*"``, would raise an assertion error in the case where the query didn't contain any actual entities. This assertion is meant for other cases and was catching this one inadvertently.
* - 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]
* - Fixed an 0.9 regression where ORM instance or mapper events appliedMike Bayer2014-02-091-0/+57
| | | | | | | | to a base class such as a declarative base with the propagate=True flag would fail to apply to existing mapped classes which also used inheritance due to an assertion. Addtionally, repaired an attribute error which could occur during removal of such an event, depending on how it was first assigned. [ticket:2949]
* - Improved the initialization logic of composite attributes such thatMike Bayer2014-02-031-0/+13
| | | | | | calling ``MyClass.attribute`` will not require that the configure mappers step has occurred, e.g. it will just work without throwing any error. [ticket:2935]
* - 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]
* - Added a new directive used within the scope of an attribute "set" operationMike Bayer2014-01-311-0/+51
| | | | | | | | to disable autoflush, in the case that the attribute needs to lazy-load the "old" value, as in when replacing one-to-one values or some kinds of many-to-one. A flush at this point otherwise occurs at the point that the attribute is None and can cause NULL violations. [ticket:2921]
* - Added a new parameter :paramref:`.Operators.op.is_comparison`. ThisMike Bayer2014-01-311-0/+39
| | | | | | flag allows a custom op from :meth:`.Operators.op` to be considered as a "comparison" operator, thus usable for custom :paramref:`.relationship.primaryjoin` conditions.
* - 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]
* - repair the fixture/test here to make sure state isn't left over causing ↵Mike Bayer2014-01-271-1/+1
| | | | other tests to fail
* - Fixed an 0.9 regression where the automatic aliasing applied byMike Bayer2014-01-231-0/+36
| | | | | | | | | | :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]
* - Support is improved for supplying a :func:`.join` construct as theMike Bayer2014-01-223-4/+193
| | | | | | | | | | target of :paramref:`.relationship.secondary` for the purposes of creating very complex :func:`.relationship` join conditions. The change includes adjustments to query joining, joined eager loading to not render a SELECT subquery, changes to lazy loading such that the "secondary" target is properly included in the SELECT, and changes to declarative to better support specification of a join() object with classes as targets.