summaryrefslogtreecommitdiff
path: root/test/orm
Commit message (Collapse)AuthorAgeFilesLines
* added ORM supportMario Lassnig2013-11-141-2/+51
|
* add psql FOR UPDATE OF functionalityMario Lassnig2013-11-121-0/+16
|
* - 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.
* python2 pickle here failsMike Bayer2013-10-251-0/+3
|
* - :func:`.attributes.get_history()` when used with a scalar column-mappedMike Bayer2013-10-252-5/+72
| | | | | | | | | attribute will now honor the "passive" flag passed to it; as this defaults to ``PASSIVE_OFF``, the function will by default query the database if the value is not present. This is a behavioral change vs. 0.8. [ticket:2787] - Added new method :meth:`.AttributeState.load_history`, works like :attr:`.AttributeState.history` but also fires loader callables.
* An overhaul of expression handling for special symbols particularlyMike Bayer2013-10-231-1/+0
| | | | | | | | | | 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]
* use a set here alsoMike Bayer2013-10-181-2/+2
|
* - fix non-deterministic ordering pointMike Bayer2013-10-141-2/+3
|
* - fix test warning here (oursql)Mike Bayer2013-10-141-2/+2
|
* - Added new option to :func:`.relationship` ``distinct_target_key``.Mike Bayer2013-10-131-0/+194
| | | | | | | | | | | | | | | This enables the subquery eager loader strategy to apply a DISTINCT to the innermost SELECT subquery, to assist in the case where duplicate rows are generated by the innermost query which corresponds to this relationship (there's not yet a general solution to the issue of dupe rows within subquery eager loading, however, when joins outside of the innermost subquery produce dupes). When the flag is set to ``True``, the DISTINCT is rendered unconditionally, and when it is set to ``None``, DISTINCT is rendered if the innermost relationship targets columns that do not comprise a full primary key. The option defaults to False in 0.8 (e.g. off by default in all cases), None in 0.9 (e.g. automatic by default). Thanks to Alexander Koval for help with this. [ticket:2836]
* use accepts scalar loader here so we deal with _ProxyImpl correctlyMike Bayer2013-10-111-1/+3
|
* - fix bug due to regression from #2793, make sure we only go to loadMike Bayer2013-10-111-1/+13
| | | | | scalar attributes here and not relationships, else we get an error if there's no actual scalars to load
* - fix a bunch of test failuresMike Bayer2013-10-082-6/+7
|
* - add an option to Bundle single_entity=True to allow for singleMike Bayer2013-10-071-0/+31
| | | | entity returns without otherwise changing much [ticket:2824]
* - add some tests for propagate of wildcard lazyloadMike Bayer2013-10-061-1/+48
|
* 11th hour realization that Load() needs to do the _chop_path() thing asMike Bayer2013-10-061-0/+79
| | | | well. this probably has some bugs
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-069-943/+1337
| | | | | | | | | | | | | - 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-0/+13
|
* - A new construct :class:`.Bundle` is added, which allows for specificationMike Bayer2013-10-032-3/+291
| | | | | | | | | | | | | | | | of groups of column expressions to a :class:`.Query` construct. The group of columns are returned as a single tuple by default. The behavior of :class:`.Bundle` can be overridden however to provide any sort of result processing to the returned row. One example included is :attr:`.Composite.Comparator.bundle`, which applies a bundled form of a "composite" mapped attribute. [ticket:2824] - The :func:`.composite` construct now maintains the return object when used in a column-oriented :class:`.Query`, rather than expanding out into individual columns. This makes use of the new :class:`.Bundle` feature internally. This behavior is backwards incompatible; to select from a composite column which will expand out, use ``MyClass.some_composite.clauses``.
* - Removed some now unneeded version checks [ticket:2829] courtesy alex gaynorMike Bayer2013-09-222-6/+4
|
* - modify what we did in [ticket:2793] so that we can also set theMike Bayer2013-09-061-0/+86
| | | | | version id programmatically outside of the generator. using this system, we can also leave the version id alone.
* Fixed Query.exists() method for the case, when query doesn't have any ↵Vladimir Magamedov2013-09-041-1/+10
| | | | filters applied.
* - cx_oracle seems to have a bug here though it is hard to track downMike Bayer2013-08-271-0/+1
| | | | - cx_oracle dialect doesn't use normal col names, lets just not rely on that for now
* - ensure rowcount is returned for an UPDATE with no implicit returningMike Bayer2013-08-251-1/+1
| | | | | - modernize test for that - use py3k compatible next() in test_returning/test_versioning
* - The ``version_id_generator`` parameter of ``Mapper`` can now be specifiedMike Bayer2013-08-252-5/+196
| | | | | | | | | | | | | | | | | | | | | to rely upon server generated version identifiers, using triggers or other database-provided versioning features, by passing the value ``False``. The ORM will use RETURNING when available to immediately load the new version identifier, else it will emit a second SELECT. [ticket:2793] - The ``eager_defaults`` flag of :class:`.Mapper` will now allow the newly generated default values to be fetched using an inline RETURNING clause, rather than a second SELECT statement, for backends that support RETURNING. - Added a new variant to :meth:`.ValuesBase.returning` called :meth:`.ValuesBase.return_defaults`; this allows arbitrary columns to be added to the RETURNING clause of the statement without interfering with the compilers usual "implicit returning" feature, which is used to efficiently fetch newly generated primary key values. For supporting backends, a dictionary of all fetched values is present at :attr:`.ResultProxy.returned_defaults`. - add a glossary entry for RETURNING - add documentation for version id generation, [ticket:867]
* Fixed bug where list instrumentation would fail to represent aMike Bayer2013-08-201-3/+8
| | | | | | | | setslice of ``[0:0]`` correctly, which in particular could occur when using ``insert(0, item)`` with the association proxy. Due to some quirk in Python collections, the issue was much more likely with Python 3 rather than 2. Also in 0.8.3, 0.7.11. [ticket:2807]
* more tests regarding expiry, deferralMike Bayer2013-08-171-1/+57
|
* some tests regarding how newly inserted rows are treated as far as fetch on ↵Mike Bayer2013-08-171-1/+91
| | | | access
* - spot checking of imports, obsolete functionsMike Bayer2013-08-171-4/+4
|
* Improved support for the cymysql driver, supporting version 0.6.5,Mike Bayer2013-08-171-1/+1
| | | | courtesy Hajime Nakagami.
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-142-8/+9
| | | | | | | | | - rework the event system so that event modules load after their targets, dependencies are reversed - create an improved strategy lookup system for the ORM - rework the ORM to have very few import cycles - move out "importlater" to just util.dependency - other tricks to cross-populate modules in as clear a way as possible
* - A large refactoring of the ``sqlalchemy.sql`` package has reorganizedMike Bayer2013-08-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | the import structure of many core modules. ``sqlalchemy.schema`` and ``sqlalchemy.types`` remain in the top-level package, but are now just lists of names that pull from within ``sqlalchemy.sql``. Their implementations are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``, ``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``, ``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``. Most of the "factory" functions used to create SQL expression objects have been moved to classmethods or constructors, which are exposed in ``sqlalchemy.sql.expression`` using a programmatic system. Care has been taken such that all the original import namespaces remain intact and there should be no impact on any existing applications. The rationale here was to break out these very large modules into smaller ones, provide more manageable lists of function names, to greatly reduce "import cycles" and clarify the up-front importing of names, and to remove the need for redundant functions and documentation throughout the expression package.
* - add predictable_gc to a few more tests showing up on pypyMike Bayer2013-08-042-6/+8
|
* - add a clear() to SetIsh here so that the control/direct gets clearedMike Bayer2013-08-021-10/+16
| | | | | before we do the pop() test. - make clear()/pop() test unconditional
* Added a new attribute :attr:`.Session.info` to :class:`.Session`;Mike Bayer2013-08-021-0/+17
| | | | | | | | this is a dictionary where applications can store arbitrary data local to a :class:`.Session`. The contents of :attr:`.Session.info` can be also be initialized using the ``info`` argument of :class:`.Session` or :class:`.sessionmaker`.
* - assorted fixes raised by pypy 2.1beta2, but all of which are goodMike Bayer2013-08-012-7/+11
| | | | | | | | | | | | | | | ideas in general: - pypy2.1 w/ sqlite3 is the first DBAPI we're seeing returning unicode in cursor.description without being py3k. add a new on-connect check for this, if we get back a u"", just don't do description decoding, should be OK for now. - the set tests in test_collection were assuming the two sets would be ordered the same when it tested pop(), can't really assume that. - test_serializer gets worse and worse, pickle is just not really viable here, ding out pypy - pypy2.1b2 seems to allow cursor.lastrowid to work (or we changed something?) - pool._threadconns.current() is a weakref, it can be None - another one of those logging.handlers imports
* - Removal of event listeners is now implemented. The feature isMike Bayer2013-07-261-11/+69
| | | | | | | | | | | | | | | | provided via the :func:`.event.remove` function. [ticket:2268] - reorganization of event.py module into a package; with the addition of the docstring work as well as the new registry for removal, there's a lot more code now. the package separates concerns and provides a top-level doc for each subsection of functionality - the remove feature works by providing the EventKey object which associates the user-provided arguments to listen() with a global, weak-referencing registry. This registry stores a collection of _ListenerCollection and _DispatchDescriptor objects associated with each set of arguments, as well as the wrapped function which was applied to that collection. The EventKey can then be recreated for a removal, all the _ListenerCollection and _DispatchDescriptor objects are located, and the correct wrapped function is removed from each one.
* - The mechanism by which attribute events pass along anMike Bayer2013-07-262-13/+6
| | | | | | | | | | | | | | | | | | | :class:`.AttributeImpl` as an "initiator" token has been changed; the object is now an event-specific object called :class:`.attributes.Event`. Additionally, the attribute system no longer halts events based on a matching "initiator" token; this logic has been moved to be specific to ORM backref event handlers, which are the typical source of the re-propagation of an attribute event onto subsequent append/set/remove operations. End user code which emulates the behavior of backrefs must now ensure that recursive event propagation schemes are halted, if the scheme does not use the backref handlers. Using this new system, backref handlers can now peform a "two-hop" operation when an object is appended to a collection, associated with a new many-to-one, de-associated with the previous many-to-one, and then removed from a previous collection. Before this change, the last step of removal from the previous collection would not occur. [ticket:2789]
* Fixed bug in ORM-level event registration where the "raw" orMike Bayer2013-07-181-13/+55
| | | | | | "propagate" flags could potentially be mis-configured in some "unmapped base class" configurations. Also in 0.8.3. [ticket:2786]
* A performance fix related to the usage of the :func:`.defer` optionMike Bayer2013-07-131-7/+16
| | | | | | | | | | | | | when loading mapped entities. The function overhead of applying a per-object deferred callable to an instance at load time was significantly higher than that of just loading the data from the row (note that ``defer()`` is meant to reduce DB/network overhead, not necessarily function call count); the function call overhead is now less than that of loading data from the column in all cases. There is also a reduction in the number of "lazy callable" objects created per load from N (total deferred values in the result) to 1 (total number of deferred cols). [ticket:2778]
* - create a new system where we can decorate an event methodMike Bayer2013-07-081-21/+72
| | | | | | | | | | | | | | | | with @_legacy_signature, will inspect incoming listener functions to see if they match an older signature, will wrap into a newer sig - add an event listen argument named=True, will send all args as kw args so that event listeners can be written with **kw, any combination of names - add a doc system to events that writes out the various calling styles for a given event, produces deprecation messages automatically. a little concerned that it's a bit verbose but will look at it up on RTD for awhile to get a feel. - change the calling signature for bulk update/delete events - we have the BulkUD object right there, and there's at least six or seven things people might want to see, so just send the whole BulkUD in [ticket:2775]
* - 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.
* Fixed bug whereby attribute history functions would failMike Bayer2013-07-041-43/+128
| | | | | | | when an object we moved from "persistent" to "pending" using the :func:`.make_transient` function, for operations involving collection-based backrefs. [ticket:2773]
* - additional fix for [ticket:2750] where on an update, we make sure theMike Bayer2013-06-301-2/+33
| | | | value is present
* add better tests for [ticket:2750]Mike Bayer2013-06-301-3/+45
|
* A warning is emitted when trying to flush an object of an inheritedMike Bayer2013-06-301-3/+23
| | | | | mapped class where the polymorphic discriminator has been assigned to a value that is invalid for the class. [ticket:2750]
* - fix a regression caused by #2587, where query.join() would apply anMike Bayer2013-06-272-0/+89
| | | | | adapter to an aliased-mapped, non-polymorphic selectable that prevented us from referring directly to that selectable.
* - 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.
* The resolution of :class:`.ForeignKey` objects to theirMike Bayer2013-06-231-1/+2
| | | | | | | | | | | | | | | | | | target :class:`.Column` has been reworked to be as immediate as possible, based on the moment that the target :class:`.Column` is associated with the same :class:`.MetaData` as this :class:`.ForeignKey`, rather than waiting for the first time a join is constructed, or similar. This along with other improvements allows earlier detection of some foreign key configuration issues. Also included here is a rework of the type-propagation system, so that it should be reliable now to set the type as ``None`` on any :class:`.Column` that refers to another via :class:`.ForeignKey` - the type will be copied from the target column as soon as that other column is associated, and now works for composite foreign keys as well. [ticket:1765]
* - rework PropComparator.adapted() to be PropComparator.adapt_to_entity(),Mike Bayer2013-06-171-1/+1
| | | | | | | passes in AliasedInsp and allows more flexibility. - rework the AliasedClass/AliasedInsp relationship so that AliasedInsp has all state and functionality. AliasedClass is just a facade. [ticket:2756]