diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-12 13:14:14 -0700 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-12 13:14:14 -0700 |
commit | 6c03a8ddd366b62285e2671a25a429f7bff1d052 (patch) | |
tree | 3ef6f29e6a2b04f6112345d501d10fd2a5f184fd /lib/sqlalchemy/ext/declarative.py | |
parent | 5448f6129cd0487c3d06324385cc2ef0701b5815 (diff) | |
download | sqlalchemy-6c03a8ddd366b62285e2671a25a429f7bff1d052.tar.gz |
- add __table_cls__ option to declarative, not publicized yet, is for the moment
for the benefit of the test.lib.schema package.
- use test.lib.schema.Table for the table within test.lib.fixtures.DeclarativeMappedTest
- [bug] Removed the check for number of
rows affected when doing a multi-delete
against mapped objects. If an ON DELETE
CASCADE exists between two rows, we can't
get an accurate rowcount from the DBAPI;
this particular count is not supported
on most DBAPIs in any case, MySQLdb
is the notable case where it is.
[ticket:2403]
Diffstat (limited to 'lib/sqlalchemy/ext/declarative.py')
-rwxr-xr-x | lib/sqlalchemy/ext/declarative.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index 891130a48..faf575da1 100755 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -1213,6 +1213,12 @@ def _as_declarative(cls, classname, dict_): del our_stuff[key] cols = sorted(cols, key=lambda c:c._creation_order) table = None + + if hasattr(cls, '__table_cls__'): + table_cls = util.unbound_method_to_callable(cls.__table_cls__) + else: + table_cls = Table + if '__table__' not in dict_: if tablename is not None: @@ -1230,7 +1236,7 @@ def _as_declarative(cls, classname, dict_): if autoload: table_kw['autoload'] = True - cls.__table__ = table = Table(tablename, cls.metadata, + cls.__table__ = table = table_cls(tablename, cls.metadata, *(tuple(cols) + tuple(args)), **table_kw) else: |