summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #100 from plaes/typosmike bayer2014-07-061-1/+1
|\ | | | | Typo fixes
| * typo: s/tranasction/transactionPriit Laes2014-06-281-1/+1
| |
* | - Fixed bug where items that were persisted, deleted, or had aMike Bayer2014-07-011-1/+4
| | | | | | | | | | | | | | primary key change within a savepoint block would not participate in being restored to their former state (not in session, in session, previous PK) after the outer transaction were rolled back. fixes #3108
* | - repair the _enable_single_crit method, it was named the sameMike Bayer2014-06-302-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | - cut out some calls by inlining the calls to get_history()Mike Bayer2014-06-281-9/+8
|/
* - Fixed bug involving dynamic attributes, that was again a regressionMike Bayer2014-06-261-2/+3
| | | | | | of :ticket:`3060` from verision 0.9.5. A self-referential relationship with lazy='dynamic' would raise a TypeError within a flush operation. fixes #3099
* - reverse course in #3061 so that we instead no longer set None in the attributeMike Bayer2014-06-231-9/+1
| | | | | | | | | when we do a get; we return the None as always but we leave the dict blank and the loader callable still in place. The case for this implicit get on a pending object is not super common and there really should be no change in state at all when this operation proceeds. This change is more dramatic as it reverses a behavior SQLA has had since the first release. fixes #3061
* - Additional checks have been added for the case where an inheritingMike Bayer2014-06-201-7/+16
| | | | | | | | | | 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-122-3/+18
| | | | | | | | | 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
* revert this, not sure why that changedMike Bayer2014-05-301-1/+1
|
* - Related to :ticket:`3060`, an adjustment has been made to the unitMike Bayer2014-05-306-25/+40
| | | | | | | | | | 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.
* - Adjustment to attribute mechanics concerning when a value isMike Bayer2014-05-2911-64/+61
| | | | | | | | | | | | | | 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-284-10/+31
| | | | | | | | | | | 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-251-1/+1
| | | | | | | 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 some identity map accessorsMike Bayer2014-05-241-0/+39
| | | | - fix a bad comparison in MySQL w/ limit/offset thing
* - revert the memoized committed_state / callables changes as they appear to ↵Mike Bayer2014-05-241-19/+8
| | | | | | add to lazy loading. not really clear which approach is better in the long run.
* - fix typos in testMike Bayer2014-05-241-0/+3
| | | | - restore __len__ to identity map
* - mark translate_row, create_instance, populate_instance, append_result as ↵Mike Bayer2014-05-232-3/+25
| | | | legacy
* inliningMike Bayer2014-05-193-17/+27
|
* 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-193-45/+69
|
* Merge pull request #91 from smurfix/de_apostroph_ifymike bayer2014-05-113-6/+6
|\ | | | | Documentation fix-up: "its" vs. "it's"
| * Documentation fix-up: "its" vs. "it's"pr/91Matthias Urlichs2014-05-113-6/+6
| | | | | | | | | | | | | | | | | | Removed ungrammatical apostrophes from documentation, replacing "it's" with "its" where appropriate (but in a few cases with "it is" when that read better). While doing that, I also fixed a couple of minor typos etc. as I noticed them.
* | - Fixed ORM bug where the :func:`.class_mapper` function would maskMike Bayer2014-05-101-2/+3
|/ | | | | | | 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-267-14/+14
| | | | Found using: https://github.com/intgr/topy
* Added some links in session docsbenselme2014-04-231-35/+39
|
* - The "primaryjoin" model has been stretched a bit further to allowMike Bayer2014-04-191-26/+46
| | | | | | | | | | 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-092-2/+37
| | | | | | | 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
* - add some docs for the instancestate linkage to the inspection systemMike Bayer2014-04-041-5/+67
|
* - 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
* - Added new parameter :paramref:`.mapper.confirm_deleted_rows`. DefaultsMike Bayer2014-03-282-17/+40
| | | | | | | | | | | | 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-281-1/+12
| | | | | | 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-281-11/+15
| | | | | | | | | | | | | 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-271-4/+11
| | | | | | | | | | | | | | | | | 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
* - 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
* - A major improvement made to the mechanics by which the :class:`.Engine`Mike Bayer2014-03-221-1/+0
| | | | | | | | | | | | recycles the connection pool when a "disconnect" condition is detected; instead of discarding the pool and explicitly closing out connections, the pool is retained and a "generational" timestamp is updated to reflect the current time, thereby causing all existing connections to be recycled when they are next checked out. This greatly simplifies the recycle process, removes the need for "waking up" connect attempts waiting on the old pool and eliminates the race condition that many immediately-discarded "pool" objects could be created during the recycle operation. fixes #2985
* - Fixed bug in mutable extension as well asMike Bayer2014-03-192-3/+3
| | | | | | :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/+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.
* - Added support for the not-quite-yet-documented ``insert=True``Mike Bayer2014-03-161-10/+10
| | | | flag for :func:`.event.listen` to work with mapper / instance events.
* - fairly epic rework of the cascade documentationMike Bayer2014-03-151-60/+14
|
* - correct this to make the intention clearMike Bayer2014-03-131-2/+1
|
* - A warning is emitted if the :meth:`.MapperEvents.before_configured`Mike Bayer2014-03-111-2/+46
| | | | | | 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-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.
* fix typosMike Bayer2014-02-282-2/+2
|
* - Added a new option to :paramref:`.relationship.innerjoin` which isMike Bayer2014-02-283-24/+72
| | | | | | | | | | | 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
* - Removed stale names from ``sqlalchemy.orm.interfaces.__all__`` andMike Bayer2014-02-261-4/+4
| | | | | | refreshed with current names, so that an ``import *`` from this module again works. fixes #2975
* - Fixed regression from 0.8 where using an option likeMike Bayer2014-02-241-0/+2
| | | | | | | :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.
* -rewrite expire/refresh sectionMike Bayer2014-02-231-0/+24
|