diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-11 12:48:46 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-11 12:48:46 -0400 |
| commit | 5f0b864ad02409cf668fa7db5cbac99ac6ffc329 (patch) | |
| tree | b5f695e1fe739f65c38245a4ee83b48df0464591 | |
| parent | e74627f827542044c1d2087be95e41d4b1b46f24 (diff) | |
| download | sqlalchemy-5f0b864ad02409cf668fa7db5cbac99ac6ffc329.tar.gz | |
- The method signature of :meth:`.Dialect.reflecttable`, which in
all known cases is provided by :class:`.DefaultDialect`, has been
tightened to expect ``include_columns`` and ``exclude_columns``
arguments without any kw option, reducing ambiguity - previously
``exclude_columns`` was missing. [ticket:2748]
| -rw-r--r-- | doc/build/changelog/changelog_09.rst | 10 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/interfaces.py | 20 |
3 files changed, 22 insertions, 11 deletions
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst index aec107acd..fc4f79f4c 100644 --- a/doc/build/changelog/changelog_09.rst +++ b/doc/build/changelog/changelog_09.rst @@ -13,6 +13,16 @@ :version: 0.9.0 .. change:: + :tags: bug, engine + :tickets: 2748 + + The method signature of :meth:`.Dialect.reflecttable`, which in + all known cases is provided by :class:`.DefaultDialect`, has been + tightened to expect ``include_columns`` and ``exclude_columns`` + arguments without any kw option, reducing ambiguity - previously + ``exclude_columns`` was missing. + + .. change:: :tags: bug, sql :tickets: 2831 diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 609375c39..b2dbccb17 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -289,8 +289,7 @@ class DefaultDialect(interfaces.Dialect): """ return sqltypes.adapt_type(typeobj, self.colspecs) - def reflecttable(self, connection, table, include_columns, - exclude_columns=None): + def reflecttable(self, connection, table, include_columns, exclude_columns): insp = reflection.Inspector.from_engine(connection) return insp.reflecttable(table, include_columns, exclude_columns) diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index c94af5b1c..06c4fca62 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -193,19 +193,21 @@ class Dialect(object): pass - def reflecttable(self, connection, table, include_columns=None): + def reflecttable(self, connection, table, include_columns, exclude_columns): """Load table description from the database. Given a :class:`.Connection` and a :class:`~sqlalchemy.schema.Table` object, reflect its columns and - properties from the database. If include_columns (a list or - set) is specified, limit the autoload to the given column - names. + properties from the database. - The default implementation uses the - :class:`~sqlalchemy.engine.reflection.Inspector` interface to - provide the output, building upon the granular table/column/ - constraint etc. methods of :class:`.Dialect`. + The implementation of this method is provided by + :meth:`.DefaultDialect.reflecttable`, which makes use of + :class:`.Inspector` to retrieve column information. + + Dialects should **not** seek to implement this method, and should + instead implement individual schema inspection operations such as + :meth:`.Dialect.get_columns`, :meth:`.Dialect.get_pk_constraint`, + etc. """ @@ -248,7 +250,7 @@ class Dialect(object): Deprecated. This method is only called by the default implementation of :meth:`.Dialect.get_pk_constraint`. Dialects should - instead implement this method directly. + instead implement the :meth:`.Dialect.get_pk_constraint` method directly. """ |
