summaryrefslogtreecommitdiff
path: root/test/orm/test_mapper.py
Commit message (Collapse)AuthorAgeFilesLines
* warn on duplicate polymorphic_identitySebastian Bank2014-12-041-0/+13
|
* - add an order_by hereMike Bayer2014-11-261-1/+2
|
* - The ``info`` parameter has been added to the constructor forMike Bayer2014-08-131-1/+3
| | | | | | | | | | | :class:`.SynonymProperty` and :class:`.ComparableProperty`. - The ``info`` parameter has been added as a constructor argument to all schema constructs including :class:`.MetaData`, :class:`.Index`, :class:`.ForeignKey`, :class:`.ForeignKeyConstraint`, :class:`.UniqueConstraint`, :class:`.PrimaryKeyConstraint`, :class:`.CheckConstraint`. fixes #2963
* - Additional checks have been added for the case where an inheritingMike Bayer2014-06-201-4/+12
| | | | | | | | | | 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
* - 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-261-2/+2
| | | | Found using: https://github.com/intgr/topy
* - changelog + test for pullreq github 58Mike Bayer2014-01-141-0/+7
|
* - Fixed regression where we don't check the given name against theMike Bayer2014-01-021-0/+16
| | | | | | 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]
* - Added new argument ``include_backrefs=True`` to theMike Bayer2013-12-021-133/+0
| | | | | | | :func:`.validates` function; when set to False, a validation event will not be triggered if the event was initated as a backref to an attribute operation from the other side. [ticket:1535] - break out validation tests into an updated module test_validators
* - remove informix dialect, moved out to ↵Mike Bayer2013-11-171-2/+0
| | | | | | https://bitbucket.org/zzzeek/sqlalchemy_informixdb - remove informix, maxdb, access symbols from tests etc.
* - merge ticket_1418 branch, [ticket:1418]Mike Bayer2013-10-061-348/+3
| | | | | | | | | | | | | - 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.
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-141-8/+8
| | | | | | | | | - 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
* - assorted fixes raised by pypy 2.1beta2, but all of which are goodMike Bayer2013-08-011-0/+1
| | | | | | | | | | | | | | | 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
* remove all remaining start/end py2k/py3k blocksMike Bayer2013-06-071-25/+21
|
* - improve overlapping selectables, apply to both query and relationshipMike Bayer2013-06-041-14/+10
| | | | | | - clean up inspect() calls within query._join() - make sure join.alias(flat) propagates - fix almost all assertion tests
* - the raw 2to3 runMike Bayer2013-04-271-31/+32
| | | | - went through examples/ and cleaned out excess list() calls
* A meaningful :attr:`.QueryableAttribute.info` attribute isMike Bayer2013-03-091-0/+31
| | | | | | | | added, which proxies down to the ``.info`` attribute on either the :class:`.schema.Column` object if directly present, or the :class:`.MapperProperty` otherwise. The full behavior is documented and ensured by tests to remain stable. [ticket:2675]
* - Improved checking for an existing backref name conflict duringMike Bayer2013-03-031-1/+19
| | | | | | | | | | | | | | | | | | | | mapper configuration; will now test for name conflicts on superclasses and subclasses, in addition to the current mapper, as these conflicts break things just as much. This is new for 0.8, but see below for a warning that will also be triggered in 0.7.11. - Improved the error message emitted when a "backref loop" is detected, that is when an attribute event triggers a bidirectional assignment between two other attributes with no end. This condition can occur not just when an object of the wrong type is assigned, but also when an attribute is mis-configured to backref into an existing backref pair. Also in 0.7.11. - A warning is emitted when a MapperProperty is assigned to a mapper that replaces an existing property, if the properties in question aren't plain column-based properties. Replacement of relationship properties is rarely (ever?) what is intended and usually refers to a mapper mis-configuration. Also in 0.7.11. [ticket:2674]
* - refactor of pathing mechanics, to address #2614, #2617Mike Bayer2012-12-011-1/+0
| | | | | | | | | | | | | | | | | | | - paths now store Mapper + MapperProperty now instead of string key, so that the parent mapper for the property is known, supports same-named properties on multiple subclasses - the Mapper within the path is now always relevant to the property to the right of it. PathRegistry does the translation now, instead of having all the outside users of PathRegistry worry about it, to produce a path that is much more consistent. Paths are now consistent with mappings in all cases. Special logic to get at "with_polymorphic" structures and such added also. - AliasedClass now has two modes, "use_mapper_path" and regular; "use_mapper_path" is for all those situations where we put an AliasedClass in for a plain class internally, and want it to "path" with the plain mapper. - The AliasedInsp is now the first class "entity" for an AliasedClass, and is passed around internally and used as attr._parententity and such. it is the AliasedClass analogue for Mapper.
* - some naming changes on PropComparator, Comparator:Mike Bayer2012-10-251-8/+18
| | | | | | | | | | | | | 1. all Comparators now have "parent" which is always the parent mapper or AliasedClass instance 2. only RelationshipProperty.Comparator has "mapper" now, which is the target mapper 3. The names "parententity" and "parentmapper" are underscored also improved the message with the "neither comparator nor instruentedattribute...." to include the classname + attribute name
* - [feature] "scalar" selects now have a WHERE methodMike Bayer2012-10-151-7/+25
| | | | | | | | | | | | | | | | | | | | to help with generative building. Also slight adjustment regarding how SS "correlates" columns; the new methodology no longer applies meaning to the underlying Table column being selected. This improves some fairly esoteric situations, and the logic that was there didn't seem to have any purpose. - [feature] Some support for auto-rendering of a relationship join condition based on the mapped attribute, with usage of core SQL constructs. E.g. select([SomeClass]).where(SomeClass.somerelationship) would render SELECT from "someclass" and use the primaryjoin of "somerelationship" as the WHERE clause. This changes the previous meaning of "SomeClass.somerelationship" when used in a core SQL context; previously, it would "resolve" to the parent selectable, which wasn't generally useful. Related to [ticket:2245].
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-6/+6
| | | | | | | become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
* fix 2.5 ismMike Bayer2012-08-251-1/+1
|
* - [feature] Added support for .info dictionary argument toMike Bayer2012-08-241-0/+21
| | | | | | column_property(), relationship(), composite(). All MapperProperty classes have an auto-creating .info dict available overall.
* - [feature] The Core oeprator system now includesMike Bayer2012-08-201-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the `getitem` operator, i.e. the bracket operator in Python. This is used at first to provide index and slice behavior to the Postgresql ARRAY type, and also provides a hook for end-user definition of custom __getitem__ schemes which can be applied at the type level as well as within ORM-level custom operator schemes. Note that this change has the effect that descriptor-based __getitem__ schemes used by the ORM in conjunction with synonym() or other "descriptor-wrapped" schemes will need to start using a custom comparator in order to maintain this behavior. - [feature] postgresql.ARRAY now supports indexing and slicing. The Python [] operator is available on all SQL expressions that are of type ARRAY; integer or simple slices can be passed. The slices can also be used on the assignment side in the SET clause of an UPDATE statement by passing them into Update.values(); see the docs for examples. - [feature] Added new "array literal" construct postgresql.array(). Basically a "tuple" that renders as ARRAY[1,2,3].
* - all tests passMike Bayer2012-08-131-2/+4
|
* - [feature] Can now provide class-bound attributesMike Bayer2012-08-041-2/+56
| | | | | | that override columns which are of any non-ORM type, not just descriptors. [ticket:2535]
* - express most of the orm.util functions in terms of the inspection systemMike Bayer2012-07-161-57/+85
| | | | | | | | | | | | | | - modify inspection system: 1. raise a new exception for any case where the inspection context can't be returned. this supersedes the "not mapped" errors. 2. don't configure mappers on a mapper inspection. this allows the inspectors to be used during mapper config time. instead, the mapper configures on "with_polymorphic_selectable" now, which is needed for all queries - add a bunch of new "is_XYZ" attributes to inspectors - finish making the name change of "compile" -> "configure", for some reason this was only done partially
* merge patch for [ticket:2208]. This still needs documentation.Mike Bayer2012-04-231-8/+0
|\
| * begin implementing inspection system for #2208Mike Bayer2012-04-031-8/+0
| |
* | - merged #1401 branch from bitbucketMike Bayer2012-04-221-0/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - resolved some serious speed hits I missed, we need to ensure only deannotated columns are used in the local/remote collections and soforth so that hash lookups against mapped columns don't dig into __eq__() - fix some other parity mismatches regarding stuff from [ticket:2453], including finding another case where _deep_annotate() was doing the wrong thing, new tests. - [feature] Major rewrite of relationship() internals now allow join conditions which include columns pointing to themselves within composite foreign keys. A new API for very specialized primaryjoin conditions is added, allowing conditions based on SQL functions, CAST, etc. to be handled by placing the annotation functions remote() and foreign() inline within the expression when necessary. Previous recipes using the semi-private _local_remote_pairs approach can be upgraded to this new approach. [ticket:1401]
| * | - figured out again why deannotate must clone()Mike Bayer2012-02-111-2/+3
| | | | | | | | | | | | | | | - got everything working. just need to update error strings
| * | many fixes but still can't get heuristics to work as well as what's existing,Mike Bayer2012-02-111-1/+2
| | | | | | | | | | | | tests still failing
* | | - [feature] Added new flag to @validatesMike Bayer2012-04-111-4/+60
| |/ |/| | | | | | | | | | | | | include_removes. When True, collection remove and attribute del events will also be sent to the validation function, which accepts an additional argument "is_remove" when this flag is used.
* | - [bug] Fixed bug whereby if a method nameMike Bayer2012-02-121-0/+8
|/ | | | | | | conflicted with a column name, a TypeError would be raised when the mapper tried to inspect the __get__() method on the method object. [ticket:2352]
* break out _save_obj(), _delete_obj(), _post_update() into a new moduleMike Bayer2012-01-301-1/+1
| | | | | | | persistence.py - Mapper loses awareness of how to emit INSERT/UPDATE/DELETE, persistence.py is only used by unitofwork.py. Then break each method out into a top level with almost no logic, calling into _organize_states_for_XYZ(), _collect_XYZ_commands(), _emit_XYZ_statements().
* - Standalone expressions in polymorphic_onMike Bayer2011-12-091-5/+9
| | | | | | | | | | | propagate to single-table inheritance subclasses so that they are used in the WHERE /JOIN clause to limit rows to that subclass as is the usual behavior. - make sure implicit map to polymorphic_on expr handles creating a label(). Use an explicit name here as _sa_polymorphic_on makes more sense when poking around in _props.
* - [bug] Updated warning message when settingMike Bayer2011-12-041-7/+0
| | | | | | | | | | delete-orphan without delete to no longer refer to 0.6, as we never got around to upgrading this to an exception. Ideally this might be better as an exception but it's not critical either way. [ticket:2325] - add new test suite to test_cascades for cascade arguments
* - [bug] Fixed bug whereby column_property() createdMike Bayer2011-12-031-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | | against ORM-level column could be treated as a distinct entity when producing certain kinds of joined-inh joins. [ticket:2316] - [bug] related to [ticket:2316], made some adjustments to the change from [ticket:2261] regarding the "from" list on a select(). The _froms collection is no longer memoized, as this simplifies various use cases and removes the need for a "warning" if a column is attached to a table after it was already used in an expression - the select() construct will now always produce the correct expression. There's probably no real-world performance hit here; select() objects are almost always made ad-hoc, and systems that wish to optimize the re-use of a select() would be using the "compiled_cache" feature. A hit which would occur when calling select.bind has been reduced, but the vast majority of users shouldn't be using "bound metadata" anyway :).
* - [bug] fixed inappropriate evaluation of user-mappedMike Bayer2011-10-281-0/+12
| | | | | object in a boolean context within query.get() [ticket:2310].
* plus synonyms accessed as stringMike Bayer2011-09-191-2/+0
|
* - Fixed previously untested function which regressedMike Bayer2011-09-151-0/+14
| | | | | in 0.7, can now make a synonym() of a synonym() again.
* - Calling class_mapper() and passing in an objectMike Bayer2011-09-091-1/+11
| | | | | | | that is not a "type" (i.e. a class that could potentially be mapped) now raises an informative ArgumentError, rather than UnmappedClassError. [ticket:2196]
* - Fixed bug whereby if __eq__() wasMike Bayer2011-09-091-0/+22
| | | | | | redefined, a relationship many-to-one lazyload would hit the __eq__() and fail. [ticket:2260] Does not apply to 0.6.9.
* - Repaired edge case where mapper would failMike Bayer2011-08-061-2/+17
| | | | | | | | to fully update internal state when a relationship on a new mapper would establish a backref on the first mapper. - continuing with tutorial, moving eager loading into its own place and describing more fully
* - Added public attribute ".validators" toMike Bayer2011-07-301-1/+31
| | | | | | | Mapper, an immutable dictionary view of all attributes that have been decorated with the @validates decorator. [ticket:2240] courtesy Stefano Fontanelli
* - Fixed bug apparent only in Python 3 wherebyMike Bayer2011-07-241-2/+40
| | | | | | | | sorting of persistent + pending objects during flush would produce an illegal comparison, if the persistent object primary key is not a single integer. [ticket:2228] Also in 0.6.9
* - Fixed bug whereby if a mapped classMike Bayer2011-07-171-27/+76
| | | | | | | | | | redefined __hash__() or __eq__() to something non-standard, which is a supported use case as SQLA should never consult these, the methods would be consulted if the class was part of a "composite" (i.e. non-single-entity) result set. [ticket:2215] Also in 0.6.9.
* dont need the DEBUG here messing up the rest of the testsMike Bayer2011-05-201-1/+0
|
* - Fixed bug whereby mapper mapped to an anonymousMike Bayer2011-05-201-0/+28
| | | | | | alias would fail if logging were used, due to unescaped % sign in the alias name. [ticket:2171] Also in 0.6.8.