Commit Graph

48 Commits

Author SHA1 Message Date
Mike Bayer f2b43da1a8 tidy test/base, test/ex, test/ext 2010-07-11 13:41:38 -04:00
Mike Bayer d6614c63b2 transfer docstrings from @classproperty to props 2010-07-04 12:06:19 -04:00
Mike Bayer 55ae7d7842 - Added support for @classproperty to provide
any kind of schema/mapping construct from a
declarative mixin, including columns with foreign
keys, relationships, column_property, deferred.
This solves all such issues on declarative mixins.
An error is raised if any MapperProperty subclass
is specified on a mixin without using @classproperty.
[ticket:1751] [ticket:1796] [ticket:1805]

- un-anglicized the declarative docs
2010-07-03 14:53:37 -04:00
Chris Withers 3c56bfde95 keep ordering of columns with mixins constant 2010-07-02 14:57:19 +01:00
Mike Bayer 6de7db07ce - a mixin class can now define a column that matches
one which is present on a __table__ defined on a
subclass.  It cannot, however, define one that is
not present in the __table__, and the error message
here now works.  [ticket:1821]
2010-06-19 13:25:37 -04:00
Mike Bayer a8e53a4f31 - Column.copy() takes along the "unique" attribute
among others, fixes [ticket:1829] regarding declarative
mixins
2010-06-15 17:56:17 -04:00
Chris Withers 5114807408 docs for new mixin class control abilities 2010-04-13 16:46:07 +01:00
Chris Withers 80897e74cb add another edge case example 2010-04-13 16:28:32 +01:00
Chris Withers aaa0ba0525 helper method for spotting inherited tables 2010-04-13 11:29:39 +01:00
Chris Withers 7339ee67e1 correct ordering 2010-04-13 01:55:32 +01:00
Chris Withers 67cdce0549 beef up test cases to reveal that I'm not as close as I'd thought :-( 2010-04-13 00:56:15 +01:00
Chris Withers 5762c9c12b correct this test case 2010-04-12 23:22:44 +01:00
Chris Withers 6fc4cba130 improve test case correctness 2010-04-09 19:02:32 +01:00
Chris Withers 5fd49b42ea learn to spell 2010-04-09 17:35:16 +01:00
Chris Withers 03ac691bd2 more testcases for propogation with mixins in declarative 2010-04-09 17:32:05 +01:00
Chris Withers 736682a589 ugh, didn't mean to commit that :-S 2010-04-07 18:14:06 +01:00
Chris Withers a5c9696a7c Add instructions to install nose adn NB that it won't happen by magic 2010-04-07 18:09:21 +01:00
Mike Bayer e9cdc0b86e test another version of the mixin here 2010-04-06 12:32:51 -04:00
Mike Bayer 87b454be9a - Further reworked the "mixin" logic in declarative to
additionally allow __mapper_args__ as a @classproperty
on a mixin, such as to dynamically assign polymorphic_identity.
2010-04-06 12:27:01 -04:00
Mike Bayer 3467339f7e remove erronrous link to "addresses" 2010-04-02 16:15:17 -04:00
Mike Bayer a3a85ed54f - Declarative will raise an informative error message
if a non-mapped class attribute is referenced in the
string-based relationship() arguments.
2010-04-02 12:42:54 -04:00
Mike Bayer b7a2d7de48 - relationships and columns with foreign keys aren't
allowed on declarative mixins, sorry.  [ticket:1751]
2010-03-26 23:14:16 -04:00
Mike Bayer 15159a844d - Using @classdecorator and similar on mixins to define
__tablename__, __table_args__, etc. now works if
the method references attributes on the ultimate
subclass. [ticket:1749]
2010-03-26 15:16:00 -04:00
Mike Bayer 03573c0517 - Using a mixin won't break if the mixin implements an
unpredictable __getattribute__(), i.e. Zope interfaces.
[ticket:1746]
2010-03-25 17:25:32 -04:00
Mike Bayer 1675811029 - To accomodate the fact that there are now two kinds of eager
loading available, the new names for eagerload() and
eagerload_all() are joinedload() and joinedload_all().  The
old names will remain as synonyms for the foreseeable future.

- The "lazy" flag on the relationship() function now accepts
a string argument for all kinds of loading: "select", "joined",
"subquery", "noload" and "dynamic", where the default is now
"select".  The old values of True/
False/None still retain their usual meanings and will remain
as synonyms for the foreseeable future.

- Added documentation to tutorial,mapper doc, api docs
for subqueryload, subqueryload_all, and other options.
2010-03-24 19:11:01 -04:00
Mike Bayer 5f15e5569c - An exception is raised when a single-table subclass specifies
a column that is already present on the base class.
[ticket:1732]
2010-03-19 13:23:06 -04:00
Mike Bayer 065fcbd9d2 - The official name for the relation() function is now
relationship(), to eliminate confusion over the relational
algebra term.  relation() however will remain available
in equal capacity for the foreseeable future.  [ticket:1740]
2010-03-17 17:48:29 -04:00
Mike Bayer e45a14e6fc add autoincrement flags to decls 2010-03-11 17:43:34 +00:00
Chris Withers a1337a822a fixes for some nasty edge cases when usng descriptors to compute special attributes 2010-03-02 10:17:31 +00:00
Chris Withers 8aaf3da70a allow __tablename__ to come from a mixin 2010-03-01 18:10:23 +00:00
Chris Withers 83d7d12b0a paranoid test that single table inheritance works with single table inheritance 2010-03-01 17:59:19 +00:00
Michael Trier 65be1c2415 Corrected problem with index too large on mysql. 2010-02-26 06:30:14 +00:00
Mike Bayer f60a5fbd5d - merge -r6823:6841 of branches/chrisw_mixin
- declarative now accepts mixin classes directly, as a means
to provide common functional and column-based elements on
all subclasses, as well as a means to propagate a fixed
set of __table_args__ or __mapper_args__ to subclasses.
For custom combinations of __table_args__/__mapper_args__ from
an inherited mixin to local, descriptors can now be used.
New details are all up in the Declarative documentation.
Thanks to Chris Withers for putting up with my strife
on this. [ticket:1707]
2010-02-25 23:15:39 +00:00
Mike Bayer bee34dfcd6 - a change to the previous __mapper_args__ commit.
- the __mapper_args__ dict is copied when propagating to a subclass,
and is taken straight off the class __dict__ to avoid any
propagation from the parent.  mapper inheritance already
propagates the things you want from the parent mapper.
[ticket:1393]
2010-02-23 00:57:08 +00:00
Mike Bayer c2060e8943 - the __mapper_args__ dict is copied when propagating to a subclass.
Still need to decide how the argument propagation should
work in the bigger picture.  [ticket:1393]
2010-02-23 00:39:35 +00:00
Mike Bayer 75c5c0322f - DeclarativeMeta exclusively uses cls.__dict__ (not dict_)
as the source of class information; _as_declarative exclusively
uses the  dict_ passed to it as the source of class information
(which when using DeclarativeMeta is cls.__dict__).  This should
in theory make it easier for custom metaclasses to modify
the state passed into _as_declarative.
2010-02-22 22:31:49 +00:00
Mike Bayer 5935b9e367 for string deferred evals, don't return the underlying Column, rely upon the original propcomparator to do what it wants.
reduces duplication of the "columns[0]" rule and removes potentially surprise behavior from the eval
2010-01-29 18:55:03 +00:00
Mike Bayer ba53c6e844 added a test to ensure the concrete example in the docs works 2010-01-25 16:22:07 +00:00
Mike Bayer 6535456ea6 - A column can be added to a joined-table declarative
superclass after the class has been constructed
(i.e. via class-level attribute assignment), and
the column will be propagated down to
subclasses. [ticket:1570]  This is the reverse
situation as that of [ticket:1523], fixed in 0.5.6.
2009-10-15 20:52:06 +00:00
Mike Bayer 9bab004a9b - unit test fixes
- py3k readme
- removed column.sequence accessor
2009-10-10 16:14:13 +00:00
Philip Jenvey 5a9c1b8824 merge from branches/clauseelement-nonzero
adds a __nonzero__ to _BinaryExpression to avoid faulty comparisons during hash
collisions (which only occur on Jython)
fixes #1547
2009-09-24 02:11:56 +00:00
Mike Bayer 75848ce2c8 - Table objects declared in the MetaData can now be used
in string expressions sent to primaryjoin/secondaryjoin/
secondary - the name is pulled from the MetaData of the
declarative base.  [ticket:1527]
2009-09-12 20:28:10 +00:00
Mike Bayer 4888c89ce5 - A column can be added to a joined-table subclass after
the class has been constructed (i.e. via class-level
attribute assignment).  The column is added to the underlying
Table as always, but now the mapper will rebuild its
"join" to include the new column, instead of raising
an error about "no such column, use column_property()
instead".  [ticket:1523]
- added an additional test in test_mappers for "added nonexistent column",
even though this test is already in test_query its more appropriate within
"mapper configuration" tests.
2009-09-01 22:26:23 +00:00
Mike Bayer a04da2a417 - added **kw to ClauseElement.compare(), so that we can smarten up the "use_get" operation
- many-to-one relation to a joined-table subclass now uses get()
  for a simple load (known as the "use_get" condition),
  i.e. Related->Sub(Base), without the need
  to redefine the primaryjoin condition in terms of the base
  table. [ticket:1186]
- specifying a foreign key with a declarative column,
  i.e. ForeignKey(MyRelatedClass.id) doesn't break the "use_get"
  condition from taking place [ticket:1492]
2009-08-08 22:21:02 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Mike Bayer a510e9f23a - Declarative will raise an informative exception if
__table_args__ is passed as a tuple with no dict argument.
Improved documentation.  [ticket:1468]
2009-07-25 20:43:11 +00:00
Mike Bayer c2108dafbd Session.mapper is now *deprecated*.
Call session.add() if you'd like a free-standing object to be
part of your session.  Otherwise, a DIY version of
Session.mapper is now documented at
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper
The method will remain deprecated throughout 0.6.


M    test/ext/test_declarative.py
M    test/orm/test_scoping.py
M    lib/sqlalchemy/orm/scoping.py
M    CHANGES
2009-07-03 15:31:29 +00:00
Mike Bayer 45cec095b4 - unit tests have been migrated from unittest to nose.
See README.unittests for information on how to run
the tests.  [ticket:970]
2009-06-10 21:18:24 +00:00