diff options
author | Jonathan Ellis <jbellis@gmail.com> | 2007-07-30 23:38:27 +0000 |
---|---|---|
committer | Jonathan Ellis <jbellis@gmail.com> | 2007-07-30 23:38:27 +0000 |
commit | b3c1b32fac892b6ac676eebaa2dba684709bf410 (patch) | |
tree | 8f776ea42934998adcba606f3ad0920fca13314f /lib/sqlalchemy/schema.py | |
parent | 030554d41b5ce16c692b037f5ee20320431cc202 (diff) | |
download | sqlalchemy-b3c1b32fac892b6ac676eebaa2dba684709bf410.tar.gz |
add warnings for deprecated methods and options
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 21822e3a4..17d4d1c77 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -1125,6 +1125,13 @@ class MetaData(SchemaItem): """return True if this MetaData is bound to an Engine.""" return self._bind is not None + def _connect(self, bind, **kwargs): + from sqlalchemy.engine.url import URL + if isinstance(bind, (basestring, URL)): + self._bind = sqlalchemy.create_engine(bind, **kwargs) + else: + self._bind = bind + def connect(self, bind, **kwargs): """bind this MetaData to an Engine. @@ -1137,14 +1144,10 @@ class MetaData(SchemaItem): directly to the given Engine. """ - - from sqlalchemy.engine.url import URL - if isinstance(bind, (basestring, URL)): - self._bind = sqlalchemy.create_engine(bind, **kwargs) - else: - self._bind = bind + self._connect(bind, **kwargs) + connect = util.deprecated(connect, False) - bind = property(lambda self:self._bind, connect, doc="""an Engine or Connection to which this MetaData is bound. this is a settable property as well.""") + bind = property(lambda self:self._bind, _connect, doc="""an Engine or Connection to which this MetaData is bound. this is a settable property as well.""") def clear(self): self.tables.clear() |