- 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]
This commit is contained in:
Mike Bayer
2013-10-11 12:48:46 -04:00
parent e74627f827
commit 5f0b864ad0
3 changed files with 22 additions and 11 deletions
+10
View File
@@ -12,6 +12,16 @@
.. changelog::
: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
+1 -2
View File
@@ -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)
+11 -9
View File
@@ -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.
"""