Commit Graph

95 Commits

Author SHA1 Message Date
Mike Bayer 75e8350e4d - comparator_factory is accepted by all MapperProperty constructors. [ticket:1149]
- added other unit tests as per [ticket:1149]
- rewrote most of the "joined table inheritance" documentation section, removed badly out of
date "polymorphic_fetch" and "select_table" arguments.
- "select_table" raises a deprecation warning.  converted unit tests to not use it.
- removed all references to "ORDER BY table.oid" from mapping docs.
- renamed PropertyLoader to RelationProperty.  Old symbol remains.
- renamed ColumnProperty.ColumnComparator to ColumnProperty.Comparator.  Old symbol remains.
2008-11-24 01:14:32 +00:00
Mike Bayer 3e486caaab - switched session.save() to session.add() throughout declarative test
- Fixed PendingDeprecationWarning involving order_by
parameter on relation(). [ticket:1226]
- Unit tests still filter pending deprecation warnings but have a commented-out
line to temporarily disable this behavior.  Tests need to be fully converted
before we can turn this on.
2008-11-14 18:57:24 +00:00
Mike Bayer 0148adec30 - Can now use a custom "inherit_condition" in
__mapper_args__ when using declarative.
2008-11-12 15:43:17 +00:00
Mike Bayer c3352e5542 - Fixed bug in Query involving order_by() in conjunction with
multiple aliases of the same class (will add tests in
[ticket:1218])
- Added a new extension sqlalchemy.ext.serializer.  Provides
Serializer/Deserializer "classes" which mirror Pickle/Unpickle,
as well as dumps() and loads().  This serializer implements
an "external object" pickler which keeps key context-sensitive
objects, including engines, sessions, metadata, Tables/Columns,
and mappers, outside of the pickle stream, and can later
restore the pickle using any engine/metadata/session provider.
This is used not for pickling regular object instances, which are
pickleable without any special logic, but for pickling expression
objects and full Query objects, such that all mapper/engine/session
dependencies can be restored at unpickle time.
2008-11-06 23:07:47 +00:00
Mike Bayer a5dfbeedb9 - Improved the behavior of aliased() objects such that they more
accurately adapt the expressions generated, which helps
particularly with self-referential comparisons. [ticket:1171]

- Fixed bug involving primaryjoin/secondaryjoin conditions
constructed from class-bound attributes (as often occurs
when using declarative), which later would be inappropriately
aliased by Query, particularly with the various EXISTS
based comparators.
2008-11-03 02:52:30 +00:00
Mike Bayer f432bd3550 - Fixed exception throw which would occur when string-based
primaryjoin condition was used in conjunction with backref.
2008-09-04 21:26:49 +00:00
Mike Bayer 94c32b19a0 - Fixed bug whereby mapper couldn't initialize if a composite
primary key referenced another table that was not defined
yet [ticket:1161]
2008-09-04 17:44:48 +00:00
Mike Bayer e01e972ac3 - fixed tearDown to reverse sorted table list 2008-08-23 19:38:04 +00:00
Mike Bayer 427ed1966f - fixed a bug in declarative test which was looking for old version of history
- Added "sorted_tables" accessor to MetaData, which returns
Table objects sorted in order of dependency as a list.
This deprecates the MetaData.table_iterator() method.
The "reverse=False" keyword argument has also been
removed from util.sort_tables(); use the Python
'reversed' function to reverse the results.
[ticket:1033]
2008-08-19 21:27:34 +00:00
Mike Bayer d371637af0 - fixed endless loop bug which could occur
within a mapper's deferred load of
inherited attributes.
- declarative initialization of Columns adjusted so that
non-renamed columns initialize in the same way as a non
declarative mapper.   This allows an inheriting mapper
to set up its same-named "id" columns in particular
such that the parent "id" column is favored over the child
column, reducing database round trips when this value
is requested.
2008-08-04 15:21:29 +00:00
Mike Bayer 8df49e7194 descriptive error message raised when string-based relation() expressions inadvertently mistake a PropertyLoader for a ColumnLoader property 2008-08-03 18:39:53 +00:00
Mike Bayer 449b33e059 relation.order_by requires _literal_as_column conversion as well 2008-07-29 19:49:46 +00:00
Mike Bayer 419753f59b - An inheriting class can now override an attribute
inherited from the base class with a plain descriptor,
or exclude an inherited attribute via the
include_properties/exclude_properties collections.
2008-07-20 18:23:44 +00:00
Mike Bayer d56862cbca - Some improvements to the _CompileOnAttr mechanism which
should reduce the probability of "Attribute x was
not replaced during compile" warnings. (this generally
applies to SQLA hackers, like Elixir devs).
2008-07-19 19:23:37 +00:00
Mike Bayer c5141f2981 - Class-bound attributes sent as arguments to
relation()'s remote_side and foreign_keys parameters
are now accepted, allowing them to be used with declarative.
2008-07-19 18:55:11 +00:00
Jason Kirtland 8fa48edbf9 - Removed 2.3 set emulations/enhancements.
(sets.Set-based collections & DB-API returns still work.)
2008-07-15 19:23:52 +00:00
Mike Bayer 5d375cd730 - Declarative supports a __table_args__ class variable, which
is either a dictionary, or tuple of the form
(arg1, arg2, ..., {kwarg1:value, ...}) which contains positional
+ kw arguments to be passed to the Table constructor.
[ticket:1096]
2008-07-09 20:38:35 +00:00
Jason Kirtland c49a7dd910 - Oops, convert @decorator to 2.3 syntax and strengthen raw_append test. 2008-06-19 17:40:13 +00:00
Mike Bayer cd95c479e9 added string argument resolution to relation() in conjunction with declarative for: order_by,
primaryjoin, secondaryjoin, secondary, foreign_keys, and remote_side.
2008-05-26 23:01:05 +00:00
Jason Kirtland 790f3d44d9 - Fixed ORM orphaning bug with _raw_append method
- Promoted _reorder to reorder
- Now horking docstrings of overloaded methods from list
- Added a doctest
2008-05-21 18:31:52 +00:00
Jason Kirtland 3b90b8d772 - 2.3 compat. 2008-05-21 02:49:14 +00:00
Mike Bayer ac934fc533 - renamed query.slice_() to query.slice()
- pulled out DeclarativeMeta.__init__ into its own function, added instrument_declarative()
which will do the "declarative" thing to any class independent of its lineage (for ctheune)
- added "cls" kwarg to declarative_base() allowing user-defined base class for declarative base [ticket:1042]
2008-05-13 20:35:41 +00:00
Jason Kirtland 72dc624bb6 Removed declared_synonym(), pep-8 clean ups. 2008-05-13 18:14:28 +00:00
Lele Gaifax 559af99865 Tag PKs with test_needs_autoincrement on a few test 2008-05-13 09:40:44 +00:00
Mike Bayer 4a6afd469f r4695 merged to trunk; trunk now becomes 0.5.
0.4 development continues at /sqlalchemy/branches/rel_0_4
2008-05-09 16:34:10 +00:00
Jason Kirtland 586e5be1bb Adjusted inplace-binops on set-based collections and association proxies to
more closely follow builtin (2.4+) set semantics.  Formerly any set duck-type
was accepted, now only types or subtypes of set, frozenset or the collection
type itself are accepted.
2008-05-05 21:33:29 +00:00
Mike Bayer 99f02b59af - fixed reentrant mapper compile hang when
a declared attribute is used within ForeignKey,
ie. ForeignKey(MyOtherClass.someattribute)
2008-05-02 18:23:16 +00:00
Mike Bayer e3460573d0 - factored out the logic used by Join to create its join condition
- With declarative, joined table inheritance mappers use a slightly relaxed
function to create the "inherit condition" to the parent
table, so that other foreign keys to not-yet-declared
Table objects don't trigger an error.
2008-05-02 01:02:23 +00:00
Jason Kirtland f035981a66 And a copy.copy() test for the proxy cache. 2008-04-29 18:28:36 +00:00
Jason Kirtland 629d6dc568 - Refresh the cached proxy if the cache was built for a different instance. 2008-04-29 18:22:23 +00:00
Mike Bayer 99ed392267 - declarative_base() takes optional kwarg "mapper", which
is any callable/class/method that produces a mapper,
such as declarative_base(mapper=scopedsession.mapper).
This property can also be set on individual declarative
classes using the "__mapper_cls__" property.
2008-03-29 14:41:41 +00:00
Mike Bayer dde6466660 - already-compiled mappers will still trigger compiles of
other uncompiled mappers when used [ticket:995]
2008-03-23 16:36:47 +00:00
Mike Bayer 8ef1bded27 added nicer error message to dependent class not found 2008-03-22 22:30:08 +00:00
Mike Bayer b9a67d1458 - added support for declarative deferred(Column(...))
- changed "instrument" argument on synonym() to "descriptor", for consistency with comparable_proeprty()
2008-03-18 17:42:07 +00:00
Mike Bayer 3d5a852b1d mapper double checks that columns in _compile_property are in the _cols_by_table collection 2008-03-18 02:38:11 +00:00
Jason Kirtland c35a717140 - Start coverage for Class.prop = Column(), promote nameless Columns 2008-03-18 02:16:15 +00:00
Jason Kirtland c462e42dfd - Declarative will complete setup for Columns lacking names, allows
a more DRY syntax.

    class Foo(Base):
        __tablename__ = 'foos'
        id = Column(Integer, primary_key=True)
2008-03-18 00:25:55 +00:00
Jason Kirtland 22197ca9c5 - Declarative gains @synonym_for and @comparable_using decorators 2008-03-17 22:55:43 +00:00
Jason Kirtland 9e15993083 Issue a warning when a declarative detects a likely trailing comma: foo = Column(foo), 2008-03-15 23:13:35 +00:00
Mike Bayer 288f9d53e3 - the "synonym" function is now directly usable with
"declarative".  Pass in the decorated property using
the "instrument" keyword argument, e.g.:
somekey = synonym('_somekey', instrument=property(g, s))
- declared_synonym deprecated
2008-03-15 20:18:54 +00:00
Mike Bayer d910cce949 reflection tests require foreign key reflection support 2008-03-11 19:15:04 +00:00
Mike Bayer 80d52d7a24 remove redundant test_rekey() test method 2008-03-10 20:19:38 +00:00
Jason Kirtland 0ad1aaa388 - Test autoload with a FK override 2008-03-10 19:21:49 +00:00
Jason Kirtland 6eeb43e5c2 - Added a primaryjoin= test 2008-03-10 18:40:36 +00:00
Jason Kirtland ac13a8445b - Added __autoload__ = True for declarative
- declarative Base.__init__ is pickier about its kwargs
2008-03-10 18:32:07 +00:00
Mike Bayer 88a8cc0c9e - a new super-small "declarative" extension has been added,
which allows Table and mapper() configuration to take place
inline underneath a class declaration.  This extension differs
from ActiveMapper and Elixir in that it does not redefine
any SQLAlchemy semantics at all; literal Column, Table
and relation() constructs are used to define the class
behavior and table definition.
2008-03-10 17:14:08 +00:00
Mike Bayer c0b5a0446b - updated the naming scheme of the base test classes in test/testlib/testing.py;
tests extend from either TestBase or ORMTest, using additional mixins for
special assertion methods as needed
2008-02-11 00:28:39 +00:00
Jason Kirtland ed74083956 - Flipped join order of __radd__ on association proxied lists. 2008-01-24 01:12:46 +00:00
Jason Kirtland 412c80dd6c - 2.3 fixup, part two: 100% passing for sqlite
- added 2.4-style binops to util.Set on 2.3
  - OrderedSets pickle on 2.3
  - more lib/sqlalchemy set vs Set corrections
  - fixed InstrumentedSet.discard for 2.3
  - set, sorted compatibility for test suite
- added testing.fails_if decorator
2008-01-21 23:19:39 +00:00
Jason Kirtland 17d3c8764e - testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase
- testing.db has the configured db
- Fixed up the perf/* scripts
2008-01-12 22:03:42 +00:00