summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
Commit message (Collapse)AuthorAgeFilesLines
* Fix sessionmaker.__repr__pr/45Timur2013-11-161-1/+1
| | | A comma separating 'class_' from the other args. It's still there even when kw is empty, which is syntactically correct.
* Merge branch 'master' of github.com:vrajmohan/sqlalchemy into mmMike Bayer2013-11-143-7/+7
|\
| * Fix cross referencespr/44Vraj Mohan2013-11-141-2/+2
| |
| * Fix references to exceptionsVraj Mohan2013-11-141-2/+2
| |
| * Fix indentation and escape *args and **kwargsVraj Mohan2013-11-132-3/+3
| |
* | Fixed bug where usage of new :class:`.Bundle` object would causeMike Bayer2013-11-131-1/+1
|/ | | | the :attr:`.Query.column_descriptions` attribute to fail.
* Fix indentation issues in docstringspr/43Vraj Mohan2013-11-122-5/+6
|
* Fix cross referencesVraj Mohan2013-11-121-5/+5
|
* - Fixed a regression introduced by :ticket:`2818` where the EXISTSMike Bayer2013-10-301-1/+1
| | | | | | 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.
* - add copyright to source files missing itMike Bayer2013-10-261-0/+1
|
* - :func:`.attributes.get_history()` when used with a scalar column-mappedMike Bayer2013-10-252-6/+43
| | | | | | | | | 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-232-3/+4
| | | | | | | | | | 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]
* these are in alphabetical orderMike Bayer2013-10-131-21/+21
|
* - Added new option to :func:`.relationship` ``distinct_target_key``.Mike Bayer2013-10-132-5/+44
| | | | | | | | | | | | | | | 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-6/+4
|
* - fix bug due to regression from #2793, make sure we only go to loadMike Bayer2013-10-112-2/+11
| | | | | 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-081-1/+1
|
* - add an option to Bundle single_entity=True to allow for singleMike Bayer2013-10-072-3/+25
| | | | entity returns without otherwise changing much [ticket:2824]
* - fix a glitch with how the default thing worked outMike Bayer2013-10-071-4/+5
|
* - add some tests for propagate of wildcard lazyloadMike Bayer2013-10-062-5/+5
|
* 11th hour realization that Load() needs to do the _chop_path() thing asMike Bayer2013-10-062-25/+55
| | | | well. this probably has some bugs
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-0611-878/+1190
| | | | | | | | | | | | | - 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-1/+10
|
* - A new construct :class:`.Bundle` is added, which allows for specificationMike Bayer2013-10-035-11/+204
| | | | | | | | | | | | | | | | 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``.
* - modify what we did in [ticket:2793] so that we can also set theMike Bayer2013-09-063-7/+10
| | | | | 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/+1
| | | | filters applied.
* - The ``version_id_generator`` parameter of ``Mapper`` can now be specifiedMike Bayer2013-08-252-73/+157
| | | | | | | | | | | | | | | | | | | | | 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]
* fix typospr/23Hyunjun Kim2013-08-252-3/+3
|
* - "primary mapper entity" is now an attribute on Query,Mike Bayer2013-08-241-16/+11
| | | | | | | | making _MapperEntity slightly less dependent on a particular parent Query (in theory more shareable by multiple Query objects in different contexts) - remove some comments that have been misunderstanding what _mapper_entities does, or perhaps forgot to get removed - simplify _mapper_entities
* move FAQ to the docs, [ticket:2133]Mike Bayer2013-08-211-1/+20
|
* Fixed bug where list instrumentation would fail to represent aMike Bayer2013-08-201-1/+4
| | | | | | | | 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]
* - use newly fixed WeakSequence (#2794) to not have to rely on class name for ↵Mike Bayer2013-08-181-5/+4
| | | | sorting in #2779
* formattingMike Bayer2013-08-181-1/+2
|
* Fixed a potential issue in an ordered sequence implementation usedMike Bayer2013-08-181-0/+1
| | | | | | | by the ORM to iterate mapper hierarchies; under the Jython interpreter this implementation wasn't ordered, even though cPython and Pypy maintained ordering. Also in 0.8.3. [ticket:2794]
* - also do delete, add seealsos, formatting, etc. [ticket:2798]Mike Bayer2013-08-181-13/+37
|
* - add better notes to query.update(), most notably how to deal with a joined ↵Mike Bayer2013-08-181-12/+36
| | | | | | table update, [ticket:2798]
* - spot checking of imports, obsolete functionsMike Bayer2013-08-177-31/+10
|
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-1423-3209/+3204
| | | | | | | | | - 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-127-37/+20
| | | | | | | | | | | | | | | | | | | | | | 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.
* ok forget it, that approach didn't really cover every base, soMike Bayer2013-08-041-0/+3
| | | | we are pretty much back to the beginning, nothing to see here
* find some more inline imports and move them outMike Bayer2013-08-044-5/+4
|
* - don't need resolve, don't need import for this. just look in sys.modules,Mike Bayer2013-08-041-2/+0
| | | | since we are dealing with cycles in any case.
* - after discussions with the original project folks working with zope securityMike Bayer2013-08-021-68/+55
| | | | | | | | | | | proxies, they aren't overriding getattr() or setattr() at all. so all the hardcoded getattr()/setattr() is removed from collections.py. Lots of these getattr/setattr were against the attributeimpl and decorated functions and don't seem like they'd ever be needed; for a user that needs special access to a collection, we can evaulate that use case and add a single point of "unwrapping", and probably add a hook for it via InstrumentationManager so that the collection implementation isn't complicated by it.
* Added a new attribute :attr:`.Session.info` to :class:`.Session`;Mike Bayer2013-08-021-2/+42
| | | | | | | | 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`.
* - update ORM event docs to include that you can listen on an unmapped base,Mike Bayer2013-07-311-29/+32
| | | | [ticket:2777]
* - Removal of event listeners is now implemented. The feature isMike Bayer2013-07-262-53/+58
| | | | | | | | | | | | | | | | 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-263-52/+123
| | | | | | | | | | | | | | | | | | | :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-5/+8
| | | | | | "propagate" flags could potentially be mis-configured in some "unmapped base class" configurations. Also in 0.8.3. [ticket:2786]
* wording about supported dialects for Query.yield_perpr/17Domen Kožar2013-07-141-6/+6
|
* A performance fix related to the usage of the :func:`.defer` optionMike Bayer2013-07-134-32/+38
| | | | | | | | | | | | | 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]