summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
Commit message (Collapse)AuthorAgeFilesLines
* Clarify that an instance's "load" event is also called when it is createdpr/90pr/89Matthias Urlichs2014-05-111-2/+3
|
* 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
|
* this isn't really the mainstream use case here; would need to talkMike Bayer2014-02-161-6/+0
| | | | about non-equality operators in general.
* - extensive cross-linking of relationship options with their documentation ↵Mike Bayer2014-02-162-104/+239
| | | | | | sections - convert all paramter references in relationship documentation to :paramref:
* remove redundant see alsoMike Bayer2014-02-161-3/+0
|
* - add cross-linking for passive_deletes / passive_updatesMike Bayer2014-02-162-4/+15
|
* - cross link remote_side/self-referentialMike Bayer2014-02-141-1/+7
| | | | - trim off fn prefix on some relationship parameter names
* - Fixed bug where :class:`.AbstractConcreteBase` would fail to beMike Bayer2014-02-112-4/+20
| | | | | | | | | | | | | | | | | | | | | fully usable within declarative relationship configuration, as its string classname would not be available in the registry of classnames at mapper configuration time. The class now explicitly adds itself to the class regsitry, and additionally both :class:`.AbstractConcreteBase` as well as :class:`.ConcreteBase` set themselves up *before* mappers are configured within the :func:`.configure_mappers` setup, using the new :meth:`.MapperEvents.before_configured` event. [ticket:2950] - Added new :meth:`.MapperEvents.before_configured` event which allows an event at the start of :func:`.configure_mappers`, as well as ``__declare_first__()`` hook within declarative to complement ``__declare_last__()``. - modified how after_configured is invoked; we just make a dispatch() not actually connected to any mapper. this makes it easier to also invoke before_configured correctly. - improved the ComparableEntity fixture to handle collections that are sets.
* - 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 an 0.9 regression where ORM instance or mapper events appliedMike Bayer2014-02-091-18/+12
| | | | | | | | 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-4/+5
| | | | | | 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]
* - 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]
* - Added a new directive used within the scope of an attribute "set" operationMike Bayer2014-01-313-3/+9
| | | | | | | | 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]
* - 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]
* - Support is improved for supplying a :func:`.join` construct as theMike Bayer2014-01-223-6/+35
| | | | | | | | | | 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.
* Merge pull request #58 from kstark/patch-1mike bayer2014-01-141-1/+1
|\ | | | | Fix TypeError for class_mapper called w/ iterable
| * Fix TypeError for class_mapper called w/ iterablepr/58Kyle Stark2014-01-131-1/+1
| | | | | | When the class_ passed is not a mapped class but is actually an iterable, the string formatting operation fails with a TypeError, and the expected ArgumentError is not raised. Calling code which is using reflection and expects this error will fail (e.g. the sadisplay module).
* | - Fixed a bug involving the new flattened JOIN structures whichMike Bayer2014-01-131-4/+3
|/ | | | | | | | | | | are used with :func:`.joinedload()` (thereby causing a regression in joined eager loading) as well as :func:`.aliased` in conjunction with the ``flat=True`` flag and joined-table inheritance; basically multiple joins across a "parent JOIN sub" entity using different paths to get to a target class wouldn't form the correct ON conditions. An adjustment / simplification made in the mechanics of figuring out the "left side" of the join in the case of an aliased, joined-inh class repairs the issue. [ticket:2908]
* - happy new yearMike Bayer2014-01-0529-29/+29
|
* - fix some docstring stuffMike Bayer2014-01-051-5/+25
|
* Merge bitbucket.org:rschoon/sqlalchemy into tMike Bayer2014-01-021-1/+2
|\
| * Don't barf on Session(info=...) from sessionmaker(info=None)Robin Schoonover2013-12-311-1/+2
| |
* | - Fixed regression where we don't check the given name against theMike Bayer2014-01-021-1/+1
| | | | | | | | | | | | correct string class when setting up a backref based on a name, therefore causing the error "too many values to unpack". This was related to the Py3k conversion. [ticket:2901]
* | - 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-302-3/+3
|