diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-02-28 10:59:41 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-02-28 13:49:09 -0500 |
| commit | a690ec082451ca0636fb45a0d9773a240ae30373 (patch) | |
| tree | 427ce67495efa3447dd4326448b4a93158826a0c /lib/sqlalchemy/engine/default.py | |
| parent | 358a0dcf10c27b3f209ac887be9960eccd588a7d (diff) | |
| download | sqlalchemy-a690ec082451ca0636fb45a0d9773a240ae30373.tar.gz | |
Add resolve_fks=False option for reflection
Added new parameters :paramref:`.Table.resolve_fks` and
:paramref:`.MetaData.reflect.resolve_fks` which when set to False will
disable the automatic reflection of related tables encountered in
:class:`.ForeignKey` objects, which can both reduce SQL overhead for omitted
tables as well as avoid tables that can't be reflected for database-specific
reasons. Two :class:`.Table` objects present in the same :class:`.MetaData`
collection can still refer to each other even if the reflection of the two
tables occurred separately.
Fixes: #4517
Change-Id: I623baed42042a16c5109e4c8af6b2f64d2d00f95
Diffstat (limited to 'lib/sqlalchemy/engine/default.py')
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 58c09a3ac..51e2c4603 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -418,11 +418,17 @@ class DefaultDialect(interfaces.Dialect): return sqltypes.adapt_type(typeobj, self.colspecs) def reflecttable( - self, connection, table, include_columns, exclude_columns, **opts + self, + connection, + table, + include_columns, + exclude_columns, + resolve_fks, + **opts ): insp = reflection.Inspector.from_engine(connection) return insp.reflecttable( - table, include_columns, exclude_columns, **opts + table, include_columns, exclude_columns, resolve_fks, **opts ) def get_pk_constraint(self, conn, table_name, schema=None, **kw): |
