summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/schema.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-10-23 15:48:51 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-10-23 15:48:51 -0400
commit51748c7a485d91dc3ba63312ef7036bcf1e3a64e (patch)
tree8a7f56ba30e806d36f4f946e35a00b33343a0dd6 /lib/sqlalchemy/schema.py
parent8ef278ec7557a5b3446807e9bc16624630ffd034 (diff)
downloadsqlalchemy-51748c7a485d91dc3ba63312ef7036bcf1e3a64e.tar.gz
Backed out changeset 8ef278ec7557a5b3446807e9bc16624630ffd034
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r--lib/sqlalchemy/schema.py38
1 files changed, 16 insertions, 22 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py
index 7ab008a10..3d00b3197 100644
--- a/lib/sqlalchemy/schema.py
+++ b/lib/sqlalchemy/schema.py
@@ -322,30 +322,27 @@ class Table(SchemaItem, expression.TableClause):
# we do it after the table is in the singleton dictionary to support
# circular foreign keys
if autoload:
- self._autoload(metadata, autoload_with, include_columns)
+ if autoload_with:
+ autoload_with.run_callable(
+ autoload_with.dialect.reflecttable,
+ self, include_columns
+ )
+ else:
+ bind = _bind_or_error(metadata,
+ msg="No engine is bound to this Table's MetaData. "
+ "Pass an engine to the Table via "
+ "autoload_with=<someengine>, "
+ "or associate the MetaData with an engine via "
+ "metadata.bind=<someengine>")
+ bind.run_callable(
+ bind.dialect.reflecttable,
+ self, include_columns
+ )
# initialize all the column, etc. objects. done after reflection to
# allow user-overrides
self._init_items(*args)
- def _autoload(self, metadata, autoload_with, include_columns):
- if autoload_with:
- autoload_with.run_callable(
- autoload_with.dialect.reflecttable,
- self, include_columns
- )
- else:
- bind = _bind_or_error(metadata,
- msg="No engine is bound to this Table's MetaData. "
- "Pass an engine to the Table via "
- "autoload_with=<someengine>, "
- "or associate the MetaData with an engine via "
- "metadata.bind=<someengine>")
- bind.run_callable(
- bind.dialect.reflecttable,
- self, include_columns
- )
-
@property
def _sorted_constraints(self):
"""Return the set of constraints as a list, sorted by creation order."""
@@ -374,9 +371,6 @@ class Table(SchemaItem, expression.TableClause):
if 'info' in kwargs:
self.info = kwargs.pop('info')
- if autoload:
- self._autoload(self.metadata, autoload_with, include_columns)
-
self._extra_kwargs(**kwargs)
self._init_items(*args)