]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- removed the connect() method of metadata,threadlocalmetadata
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 30 May 2009 01:05:25 +0000 (01:05 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 30 May 2009 01:05:25 +0000 (01:05 +0000)
- removed import of "thread" which is unused, is not "public" in py3k anyway

06CHANGES
lib/sqlalchemy/engine/threadlocal.py
lib/sqlalchemy/pool.py
lib/sqlalchemy/schema.py
lib/sqlalchemy/util.py
test/dialect/sqlite.py
test/engine/bind.py

index 22b7fbf2f9cf79b26eda2370aed0b77d45f22d07..4594bb519bb9ade803aa2c28bea46f5a720d104a 100644 (file)
--- a/06CHANGES
+++ b/06CHANGES
       create_engine(... isolation_level="..."); available on
       postgresql and sqlite. [ticket:443]
 
+- schema
+    - metadata.connect() and threadlocalmetadata.connect() have been removed.
+    - new CreateTable,DropTable,CreateSequence,DropSequence, etc.
+     
 - dialect refactor
     - the "owner" keyword argument is removed from Table.  Use "schema" to 
       represent any namespaces to be prepended to the table name.
index ec1a8f5f852ed02e3b76cfea10b2d59852912621..27d857623e37f200c220b31c34794f8aa4a27c81 100644 (file)
@@ -174,7 +174,7 @@ class TLEngine(base.Engine):
         """Construct a new TLEngine."""
 
         super(TLEngine, self).__init__(*args, **kwargs)
-        self.context = util.ThreadLocal()
+        self.context = util.threading.local()
 
         proxy = kwargs.get('proxy')
         if proxy:
index f96e1215c4ac2f6e564967b4206e519a4132ef1e..4173a78786e1244f18e0d4731a67335e64ac906b 100644 (file)
@@ -20,7 +20,7 @@ import weakref, time, threading
 
 from sqlalchemy import exc, log
 from sqlalchemy import queue as sqla_queue
-from sqlalchemy.util import thread, threading, pickle, as_interface
+from sqlalchemy.util import threading, pickle, as_interface
 
 proxies = {}
 
index d3cdeee002321de43a7a191dbee8241a119defda..5d46a9928e4cbaad6451acab73df33092ababe73 100644 (file)
@@ -1572,27 +1572,6 @@ class MetaData(SchemaItem):
 
         return self._bind is not None
 
-    @util.deprecated('Deprecated. Use ``metadata.bind = <engine>`` or '
-                     '``metadata.bind = <url>``.')
-    def connect(self, bind, **kwargs):
-        """Bind this MetaData to an Engine.
-
-        bind
-          A string, ``URL``, ``Engine`` or ``Connection`` instance.  If a
-          string or ``URL``, will be passed to ``create_engine()`` along with
-          ``\**kwargs`` to produce the engine which to connect to.  Otherwise
-          connects directly to the given ``Engine``.
-          
-        """
-        global URL
-        if URL is None:
-            from sqlalchemy.engine.url import URL
-        if isinstance(bind, (basestring, URL)):
-            from sqlalchemy import create_engine
-            self._bind = create_engine(bind, **kwargs)
-        else:
-            self._bind = bind
-
     def bind(self):
         """An Engine or Connection to which this MetaData is bound.
 
@@ -1825,35 +1804,10 @@ class ThreadLocalMetaData(MetaData):
     def __init__(self):
         """Construct a ThreadLocalMetaData."""
 
-        self.context = util.ThreadLocal()
+        self.context = util.threading.local()
         self.__engines = {}
         super(ThreadLocalMetaData, self).__init__()
 
-    @util.deprecated('Deprecated. Use ``metadata.bind = <engine>`` or '
-                     '``metadata.bind = <url>``.')
-    def connect(self, bind, **kwargs):
-        """Bind to an Engine in the caller's thread.
-
-        bind
-          A string, ``URL``, ``Engine`` or ``Connection`` instance.  If a
-          string or ``URL``, will be passed to ``create_engine()`` along with
-          ``\**kwargs`` to produce the engine which to connect to.  Otherwise
-          connects directly to the given ``Engine``.
-        """
-
-        global URL
-        if URL is None:
-            from sqlalchemy.engine.url import URL
-
-        if isinstance(bind, (basestring, URL)):
-            try:
-                engine = self.__engines[bind]
-            except KeyError:
-                from sqlalchemy import create_engine
-                engine = create_engine(bind, **kwargs)
-            bind = engine
-        self._bind_to(bind)
-
     def bind(self):
         """The bound Engine or Connection for this thread.
 
index 8c2847396e64b0b64401963d23605fdbd36176ca..adbe75e16007698fcab9ab949bd6526b26da2fa8 100644 (file)
@@ -13,12 +13,9 @@ types = __import__('types')
 from sqlalchemy import exc
 
 try:
-    import thread as thread, threading as threading
-    from threading import local as ThreadLocal
+    import threading as threading
 except ImportError:
-    import dummy_thread as thread
     import dummy_threading as threading
-    from dummy_threading import local as ThreadLocal
 
 py3k = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0)
 
index 23c038955001fad16eee9955f9db73c196d6665a..29abfe03509af23e7e2879d52a39ba3b34fd633a 100644 (file)
@@ -150,7 +150,7 @@ class TestDefaults(TestBase, AssertsExecutionResults):
             rt = Table('t_defaults', m2, autoload=True)
             expected = [c[1] for c in specs]
             for i, reflected in enumerate(rt.c):
-                self.assertEquals(reflected.server_default.arg.text, expected[i])
+                self.assertEquals(reflected.server_default.arg, expected[i])
         finally:
             m.drop_all()
 
@@ -171,7 +171,7 @@ class TestDefaults(TestBase, AssertsExecutionResults):
 
             rt = Table('r_defaults', m, autoload=True)
             for i, reflected in enumerate(rt.c):
-                self.assertEquals(reflected.server_default.arg.text, expected[i])
+                self.assertEquals(reflected.server_default.arg, expected[i])
         finally:
             db.execute("DROP TABLE r_defaults")
 
index 5b8605aada8f34462db6c9520e22865acd12c8f8..e24881d5948fb540010d80a76587458ece77971e 100644 (file)
@@ -118,7 +118,7 @@ class BindTest(testing.TestBase):
                 table = Table('test_table', metadata,
                     Column('foo', Integer))
 
-                metadata.connect(bind)
+                metadata.bind = bind
 
                 assert metadata.bind is table.bind is bind
                 metadata.create_all()