Commit Graph

2018 Commits

Author SHA1 Message Date
Mike Bayer ab9bf61445 *more* sqlite appeasement 2009-01-12 00:12:10 +00:00
Mike Bayer 91001b84c6 mysql/pg sensitive fixes 2009-01-12 00:06:47 +00:00
Mike Bayer 16c710a227 don't INSERT a blank row if no rows passed. (breaks all the tests for SQLite on the buildbot....) 2009-01-11 23:55:35 +00:00
Mike Bayer f2c302d03a added an order by 2009-01-11 23:34:36 +00:00
Mike Bayer 209e888e1b - Concrete inheriting mappers now instrument attributes which are inherited from the superclass, but are not defined for the concrete mapper itself, with an InstrumentedAttribute that issues a descriptive error when accessed. [ticket:1237]
- Added a new `relation()` keyword `back_populates`.  This allows configuation of backreferences using explicit relations. [ticket:781]  This is required when creating bidirectional relations between a hierarchy of concrete mappers and another class. [ticket:1237]
- Test coverage added for `relation()` objects specified on concrete mappers. [ticket:1237]
- A short documentation example added for bidirectional relations specified on concrete mappers. [ticket:1237]
- Mappers now instrument class attributes upon construction with the final InstrumentedAttribute object which remains persistent.  The `_CompileOnAttr`/`__getattribute__()` methodology has been removed.  The net effect is that Column-based mapped class attributes can now be used fully at the class level without invoking a mapper compilation operation, greatly simplifying typical usage patterns within declarative. [ticket:1269]
- Index now accepts column-oriented InstrumentedAttributes (i.e. column-based mapped class attributes) as column arguments.  [ticket:1214]
- Broke up attributes.register_attribute into two separate functions register_descriptor and register_attribute_impl.    The first assembles an InstrumentedAttribute or Proxy descriptor, the second assembles the AttributeImpl inside the InstrumentedAttribute.  register_attribute remains for outside compatibility.  The argument lists have been simplified.
- Removed class_manager argument from all but MutableScalarAttributeImpl (the branch had removed class_ as well but this has been reverted locally to support the serializer extension).
- Mapper's previous construction of _CompileOnAttr now moves to a new MapperProperty.instrument_class() method which is called on all MapperProperty objects at the moment the mapper receives them. All MapperProperty objects now call attributes.register_descriptor within that method to assemble an InstrumentedAttribute object directly.
- InstrumentedAttribute now receives the "property" attribute from the given PropComparator.  The guesswork within the constructor is removed, and allows "property" to serve as a mapper compilation trigger.
- RelationProperty.Comparator now triggers compilation of its parent mapper within a util.memoized_property accessor for the "property" attribute, which is used instead of "prop" (we can probably remove "prop").
- ColumnProperty and similar handle most of their initialization in their __init__ method since they must function fully at the class level before mappers are compiled.
- SynonymProperty and ComparableProperty move their class instrumentation logic to the new instrument_class() method.
- LoaderStrategy objects now add their state to existing InstrumentedAttributes using attributes.register_attribute_impl.  Both column and relation-based loaders instrument in the same way now, with a unique InstrumentedAttribute *and* a unique AttributeImpl for each class in the hierarchy.  attribute.parententity should now be correct in all cases.
- Removed unitofwork.register_attribute, and simpified the _register_attribute methods into a single function in strategies.py.  unitofwork exports the UOWEventHandler extension directly.
- To accomodate the multiple AttributeImpls across a class hierarchy, the sethasparent() method now uses an optional "parent_token" attribute to identify the "parent".  AbstractRelationLoader sends the MapperProperty along to serve as this token.  If the token isn't present (which is only the case in the attributes unit tests), the AttributeImpl is used instead, which is essentially the same as the old behavior.
- Added new ConcreteInheritedProperty MapperProperty.  This is invoked for concrete mappers within _adapt_inherited_property() to accomodate concrete mappers which inherit unhandled attributes from the base class, and basically raises an exception upon access.  [ticket:1237]
- attributes.register_attribute and register_descriptor will now re-instrument an attribute unconditionally without checking for a previous attribute.  Not sure if this is controversial. It's needed so that ConcreteInheritedProperty instrumentation can be overridden by an incoming legit MapperProperty without any complexity.
- Added new UninstrumentedColumnLoader LoaderStrategy.  This is used by the polymorphic_on argument when the given column is not represented within the mapped selectable, as is typical with a concrete scenario which maps to a polymorphic union.  It does not configure class instrumentation, keeping polymorphic_on from getting caught up in the new concrete attribute-checking logic.
- RelationProperty now records its "backref" attributes using a set assigned to `_reverse_property` instead of a scalar.  The `back_populates` keyword allows any number of properties to be involved in a single bidirectional relation.  Changes were needed to RelationProperty.merge(), DependencyProcessor to accomodate for the new multiple nature of this attribute.
- Generalized the methodology used by ManyToManyDP to check for "did the other dependency already handle this direction", building on the `_reverse_property` collection.
- post_update logic within dependency.py moves to use the same methodology as ManyToManyDP so that "did the other dependency do this already" checks are made to be specific to the two dependent instances.
- Caught that RelationProperty.merge() was writing to instance.__dict__ directly (!) - repaired to talk to instance_state.dict.
- Removed needless eager loading example from concrete mapper docs.
- Added test for [ticket:965].
- Added the usual Node class/nodes table to orm/_fixtures.py, but haven't used it for anything yet.   We can potentially update test/orm/query.py to use this fixture.
- Other test/documentation cleanup.
2009-01-11 22:41:20 +00:00
Mike Bayer 7b3b9f559a - 0.5.1 bump
- modernized mapper()/no table exception
- added __tablename__ exception to declarative since ppl keep complaining
2009-01-11 16:45:45 +00:00
Mike Bayer 0e79d6e28e move memusage to the isolation chamber 2009-01-06 18:30:38 +00:00
Mike Bayer a3ab10c3f3 - removed 2.3 compat stuff
- updated MANIFEST for the newer build
2009-01-06 18:19:59 +00:00
Mike Bayer d14317fd7a - query.join() raises an error when the target of the join
doesn't match the property-based attribute - while it's
unlikely anyone is doing this, the SQLAlchemy author was
guilty of this particular loosey-goosey behavior.
2009-01-06 04:30:11 +00:00
Michael Trier bc2c1b2f94 mssql date / time refactor.
- Added new MSSmallDateTime, MSDateTime2, MSDateTimeOffset, MSTime types
- Refactored the Date/Time types. The smalldatetime data type no longer
  truncates to a date only, and will now be mapped to the MSSmallDateTime
  type. Closes #1254.
2009-01-05 22:05:51 +00:00
Mike Bayer 182badb266 - property.of_type() is now recognized on a single-table
inheriting target, when used in the context of
prop.of_type(..).any()/has(), as well as
query.join(prop.of_type(...)).
2009-01-05 19:23:56 +00:00
Mike Bayer b5e0d613fa if at first you don't succeed, fail, fail again 2009-01-05 17:43:40 +00:00
Mike Bayer ec344ebf72 - Generalized the IdentityManagedState._instance_dict() callable
to the IdentityMap class so that Weak/StrongInstanceDict both
have the same behavior wrt the state referencing the map
- Fixed bug when using weak_instance_map=False where modified
events would not be intercepted for a flush(). [ticket:1272]
2009-01-05 15:34:09 +00:00
Mike Bayer 653191d913 added teardown_instance() to complement setup_instance().
Based on the instance/class agnostic behavior of ClassManager, this might be the best we can
do regarding [ticket:860]
2009-01-03 22:15:38 +00:00
Mike Bayer 88a799379f - query.order_by() accepts None which will remove any pending
order_by state from the query, as well as cancel out any
mapper/relation configured ordering. This is primarily useful
for overriding the ordering specified on a dynamic_loader().
[ticket:1079]
2009-01-03 20:52:34 +00:00
Mike Bayer db0d59191b added the significant test for #1247 2009-01-03 20:31:43 +00:00
Michael Trier 770f603afb Corrected an issue on mssql where Numerics would not accept an int. 2009-01-03 20:07:17 +00:00
Mike Bayer 9b89103394 added order_by test coverage as per [ticket:1218] 2009-01-03 20:06:53 +00:00
Mike Bayer 67909d9645 - Fixed bug which was preventing out params of certain types
from being received; thanks a ton to huddlej at wwu.edu !
[ticket:1265]
2009-01-03 18:58:52 +00:00
Mike Bayer 4fcb1e97d9 identified the SQLite changes which affect default reflection 2009-01-03 18:06:59 +00:00
Michael Trier 4dec075ee5 Flagged two versioning tests as failing on MSSQL. The flush occurs even though
there should be a concurrency issue.

I cheated and marked these as FIXME. With this commit all MSSQL tests pass
now. The work of correcting the ``fails_on`` tests begins.
2009-01-03 05:32:11 +00:00
Michael Trier 6b6848f124 sqlite tests run fine locally but the buildbot seems to have an issue. Perhaps this will work. 2009-01-03 04:57:31 +00:00
Michael Trier c6558eecb5 Some of the ordering fixes messed up MySQL. This should work better. Better testing next time. 2009-01-03 04:57:29 +00:00
Michael Trier 3d487b64eb Modified DefaultTest in order to get passage on mssql and still test the right stuff. 2009-01-03 03:59:54 +00:00
Michael Trier dd73bf16fd Excluded another failing test from the mssql dialect.
MSSQL doesn't allow ON UPDATE for self-referential keys. The tree of cascading
referential actions must only have one path to a particular table on the
cascading referential actions tree.
2009-01-03 03:59:49 +00:00
Mike Bayer 9fe69cb503 - Fixed some deep "column correspondence" issues which could
impact a Query made against a selectable containing
multiple versions of the same table, as well as
unions and similar which contained the same table columns
in different column positions at different levels.
[ticket:1268]
2009-01-03 02:42:34 +00:00
Michael Trier 0bd31484ea A couple of ordering fixes for the tests. 2009-01-03 02:32:10 +00:00
Michael Trier 6ea3521b45 sqlite reflection now stores the actual DefaultClause value for the column. 2009-01-02 22:40:45 +00:00
Mike Bayer 5bc1f17cb5 - mysql, postgres: "%" signs in text() constructs are automatically escaped to "%%".
Because of the backwards incompatible nature of this change,
a warning is emitted if '%%' is detected in the string.  [ticket:1267]
2009-01-02 21:24:17 +00:00
Michael Trier 2f2d84fbb1 Swap out text_as_varchar on the mssql dialect for the Types tests. 2009-01-02 20:33:14 +00:00
Michael Trier 54598789ee Marked a couple of unicode schema tests as failing on mssql. 2009-01-02 20:33:11 +00:00
Michael Trier eb1a7c1bdf Marked mssql test as failing since it cannot update identity columns. 2009-01-02 18:25:08 +00:00
Michael Trier a69db2ae63 Corrected a UOW DefaultTest for mssql because it requires the identity column setup. 2009-01-02 18:25:00 +00:00
Michael Trier f793a88403 Added ability to use subselects within INSERTS on mssql. 2009-01-02 18:24:57 +00:00
Michael Trier 9c83fafc27 Specialized trigger tests to accomodate mssql syntax. 2009-01-02 18:24:52 +00:00
Michael Trier a7fe20bfda Added note for mssql about using snapshot isolation in order to get multiple
connection session tests to pass.
2009-01-02 18:24:49 +00:00
Mike Bayer 50dfbc7e79 - Custom comparator classes used in conjunction with
column_property(), relation() etc. can define
new comparison methods on the Comparator, which will
become available via __getattr__() on the
InstrumentedAttribute.   In the case of synonym()
or comparable_property(), attributes are resolved first
on the user-defined descriptor, then on the user-defined
comparator.
2009-01-02 18:22:50 +00:00
Jonathan Ellis 3373994cfd emacs 2008-12-31 14:25:53 +00:00
Mike Bayer 7391c7bd4d yes ive been watching the IRC channel. restored setup_instance() to ClassManager and added coverage for mapper's usage of it. 2008-12-31 05:28:53 +00:00
Michael Trier f62a78242d Modifications to the mssql dialect in order to to pass through unicode in the pyodbc dialect. 2008-12-30 06:39:37 +00:00
Michael Trier 4e8a817ac2 A few 2.3 cleanup items. 2008-12-30 06:24:59 +00:00
Michael Trier df267fcc77 Added in MSGenericBinary to the mssql dialect tests. 2008-12-29 21:38:04 +00:00
Mike Bayer 8598780e8d - Added OracleNVarchar type, produces NVARCHAR2, and also
subclasses Unicode so that convert_unicode=True by default.
      NVARCHAR2 reflects into this type automatically so
      these columns pass unicode on a reflected table with no explicit
      convert_unicode=True flags.  [ticket:1233]
2008-12-28 22:32:04 +00:00
Mike Bayer bd23baf4ac - Can pass mapped attributes and column objects as keys
to query.update({}).  [ticket:1262]

- Mapped attributes passed to the values() of an
expression level insert() or update() will use the
keys of the mapped columns, not that of the mapped
attribute.
2008-12-28 21:48:12 +00:00
Michael Trier 8669eda82d Added in a new MSGenericBinary type.
This maps to the Binary type so it can implement the specialized behavior of
treating length specified types as fixed-width Binary types and non-length
types as an unbound variable length Binary type.
2008-12-28 21:07:57 +00:00
Mike Bayer 7009653aa1 - RowProxy objects can be used in place of dictionary arguments
sent to connection.execute() and friends.  [ticket:935]
2008-12-28 20:58:38 +00:00
Mike Bayer d245397bd2 - Fixed shard_id argument on ShardedSession.execute().
[ticket:1072]
2008-12-28 19:54:58 +00:00
Michael Trier cae83f6d4f On MSSQL if a field is part of the primary_key then it should not allow NULLS. 2008-12-28 07:40:56 +00:00
Michael Trier defba2fc02 MSSQL refactoring of BINARY type and addition of MSVarBinary and MSImage.
- Added in new types: MSVarBinary and MSImage
- Modified MSBinary to now return BINARY instead of IMAGE. This is a
  backwards incompatible change. Closes #1249.
2008-12-28 01:46:44 +00:00
Mike Bayer 0465d0b880 - added a full exercising test for all of #946, #947, #948, #949 2008-12-27 19:35:12 +00:00