Commit Graph

31 Commits

Author SHA1 Message Date
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
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 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
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
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
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