diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-28 15:54:28 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-28 15:54:28 -0500 |
| commit | 96dce7686c6a32ab03ce2ccaabb7a9b4ff0fe56b (patch) | |
| tree | 9468e4f0c5ee4748a21c2a2aaba7d1ddb0a74db0 /lib/sqlalchemy/engine | |
| parent | b7f7ed210501a405938bf55e08a47e35674f0247 (diff) | |
| download | sqlalchemy-96dce7686c6a32ab03ce2ccaabb7a9b4ff0fe56b.tar.gz | |
- [feature] New reflection feature "autoload_replace";
when set to False on Table, the Table can be autoloaded
without existing columns being replaced. Allows
more flexible chains of Table construction/reflection
to be constructed, including that it helps with
combining Declarative with table reflection.
See the new example on the wiki. [ticket:2356]
- [bug] Improved the API for add_column() such that
if the same column is added to its own table,
an error is not raised and the constraints
don't get doubled up. Also helps with some
reflection/declarative patterns. [ticket:2356]
Diffstat (limited to 'lib/sqlalchemy/engine')
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/reflection.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 859dc4bdc..73bd7fd71 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -254,9 +254,9 @@ class DefaultDialect(base.Dialect): """ return sqltypes.adapt_type(typeobj, self.colspecs) - def reflecttable(self, connection, table, include_columns): + def reflecttable(self, connection, table, include_columns, exclude_columns=None): insp = reflection.Inspector.from_engine(connection) - return insp.reflecttable(table, include_columns) + return insp.reflecttable(table, include_columns, exclude_columns) def get_pk_constraint(self, conn, table_name, schema=None, **kw): """Compatiblity method, adapts the result of get_primary_keys() diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py index 947423334..f5911f3b6 100644 --- a/lib/sqlalchemy/engine/reflection.py +++ b/lib/sqlalchemy/engine/reflection.py @@ -317,7 +317,7 @@ class Inspector(object): info_cache=self.info_cache, **kw) return indexes - def reflecttable(self, table, include_columns): + def reflecttable(self, table, include_columns, exclude_columns=None): """Given a Table object, load its internal constructs based on introspection. This is the underlying method used by most dialects to produce @@ -374,6 +374,8 @@ class Inspector(object): name = col_d['name'] if include_columns and name not in include_columns: continue + if exclude_columns and name in exclude_columns: + continue coltype = col_d['type'] col_kw = { |
