Commit Graph

413 Commits

Author SHA1 Message Date
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 43b9f0d116 - the compiler extension now allows @compiles decorators
on base classes that extend to child classes, @compiles
decorators on child classes that aren't broken by a
@compiles decorator on the base class.
2010-03-30 10:39:36 -04:00
Mike Bayer 51fd344737 - The sqlalchemy.orm.shard module now becomes an extension,
sqlalchemy.ext.horizontal_shard.   The old import
works with a deprecation warning.
2010-03-28 13:12:38 -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 c6bceb7775 - converted all lazy=True|False|None to 'select'|'joined'|'noload'
- converted all eager to joined in examples
- fixed beaker/advanced.py to reference RelationshipCache
2010-03-24 19:19:03 -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 67f5f4831b - fix the sqlalchemy.test.schema.Column function to work with copies
- add sequences to new associationproxy tests
- test/ext passes 100% on oracle here
2010-03-11 18:01:04 +00: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 b3f1513eaf clean up some skips, added skip for sqlite + python2 2010-02-21 21:26:11 +00:00
Mike Bayer 739b7b0c25 some more 2.4 test fixes 2010-02-15 22:37:37 +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 0b185fc84f - make frozendict serializable
- serialize tests use HIGHEST_PROTOCOL
2010-01-28 22:47:25 +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 2d15d9b0d0 - association_proxy now has basic comparator methods .any(),
.has(), .contains(), ==, !=, thanks to Scott Torborg.
[ticket:1372]
2010-01-22 20:24:27 +00:00
Mike Bayer 196284c083 - ensure correct session usage + tests 2010-01-21 20:41:52 +00:00
Mike Bayer 8c660d4611 - sqlsoup objects no longer have the 'query' attribute - it's
not needed for sqlsoup's usage paradigm and it gets in the
way of a column that is actually named 'query'.
2010-01-16 18:04:11 +00:00
Mike Bayer dc1fc3a897 - The signature of the proxy_factory callable passed to
association_proxy is now (lazy_collection, creator,
value_attr, association_proxy), adding a fourth argument
that is the parent AssociationProxy argument.  Allows
serializability and subclassing of the built in collections.
[ticket:1259]
2009-12-08 23:09:48 +00:00
Mike Bayer e972bb569a dont run sqlsoup test on jython 2009-11-10 00:48:06 +00:00
Mike Bayer 55a3e5e30d - subclassed Function off of new FunctionElement generic base
- removed "key" accessor of Function, Grouping - this doesn't seem to be used for anything
- various formatting
- documented the four "Element" classes in the compiler extension as per [ticket:1590]
2009-11-10 00:43:53 +00:00
Mike Bayer 89fcf7c3c9 add test for map explicit Table 2009-11-09 22:32:33 +00:00
Mike Bayer ba00071e74 - added a real unit test for sqlsoup
- removed doctest stuff
- redid session docs for sqlsoup
- sqlsoup stays within the transaction of a Session now, is explcitly autocommit=False by default and includes commit()/rollback() methods
- sqlsoup db.<sometable>.update() and delete() now call
query(cls).update() and delete(), respectively.
- sqlsoup now has execute() and connection(), which call upon
the Session methods of those names, ensuring that the bind is
in terms of the SqlSoup object's bind.
2009-11-09 19:41:45 +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 ed8742e685 - The collection proxies produced by associationproxy are now
pickleable.  A user-defined proxy_factory however
is still not pickleable unless it defines __getstate__
and __setstate__. [ticket:1446]
2009-07-25 17:08:38 +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
Mike Bayer 31b95e6cdc - removed test.testing.ORMTest, test.fixtures, and all
dependencies on those.
2009-06-02 21:42:14 +00:00
Mike Bayer d7e531ce9f - Back-ported the "compiler" extension from SQLA 0.6. This
is a standardized interface which allows the creation of custom
ClauseElement subclasses and compilers.  In particular it's
handy as an alternative to text() when you'd like to
build a construct that has database-specific compilations.
See the extension docs for details.
2009-05-17 22:58:21 +00:00
Michael Trier 7bb91d034f Fixed adding of deferred or othe column properties to a declarative class. 2009-04-18 15:35:07 +00:00
Mike Bayer d65c25bcc9 - Fixed __repr__() and other _get_colspec() methods on
ForeignKey constructed from __clause_element__() style
construct (i.e. declarative columns).  [ticket:1353]
2009-03-27 21:41:36 +00:00
Mike Bayer 1b5d224df5 take 2 2009-03-08 19:40:12 +00:00