From: Mike Bayer Date: Wed, 7 Feb 2007 01:12:38 +0000 (+0000) Subject: - added optional __table_opts__ dictionary to ActiveMapper, will send kw options to X-Git-Tag: rel_0_3_5~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b8cfa6ba1091b18f5b270d1cca0ad108aff23e2;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - added optional __table_opts__ dictionary to ActiveMapper, will send kw options to Table objects [ticket:462] --- diff --git a/CHANGES b/CHANGES index 2aa1ff2281..95c22fc55b 100644 --- a/CHANGES +++ b/CHANGES @@ -44,6 +44,8 @@ - ext: - added distinct() method to SelectResults. generally should only make a difference when using count(). + - added optional __table_opts__ dictionary to ActiveMapper, will send kw options to + Table objects [ticket:462] - mssql: - better support for NVARCHAR types added [ticket:298] - fix for commit logic on pymssql diff --git a/lib/sqlalchemy/ext/activemapper.py b/lib/sqlalchemy/ext/activemapper.py index 769c70b836..674cc92654 100644 --- a/lib/sqlalchemy/ext/activemapper.py +++ b/lib/sqlalchemy/ext/activemapper.py @@ -208,6 +208,7 @@ class ActiveMapperMeta(type): "__metadata__", metadata) version_id_col = None version_id_col_object = None + table_opts = {} if 'mapping' in dict: found_pk = False @@ -228,6 +229,9 @@ class ActiveMapperMeta(type): if '__version_id_col__' == name: version_id_col = value + + if '__table_opts__' == name: + table_opts = value if name.startswith('__'): continue @@ -261,10 +265,10 @@ class ActiveMapperMeta(type): ActiveMapperMeta.metadatas.add(_metadata) if not autoload: - cls.table = Table(table_name, _metadata, *columns) + cls.table = Table(table_name, _metadata, *columns, **table_opts) cls.columns = columns else: - cls.table = Table(table_name, _metadata, autoload=True) + cls.table = Table(table_name, _metadata, autoload=True, **table_opts) cls.columns = cls.table._columns # check for inheritence