From 7b8cfa6ba1091b18f5b270d1cca0ad108aff23e2 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 7 Feb 2007 01:12:38 +0000 Subject: [PATCH] - added optional __table_opts__ dictionary to ActiveMapper, will send kw options to Table objects [ticket:462] --- CHANGES | 2 ++ lib/sqlalchemy/ext/activemapper.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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 -- 2.47.2