port sipb-xen-database to sqlalchemy-0.4
authorGreg Price <price@mit.edu>
Mon, 29 Sep 2008 06:21:34 +0000 (02:21 -0400)
committerGreg Price <price@mit.edu>
Mon, 29 Sep 2008 06:21:34 +0000 (02:21 -0400)
Apparently they like breaking old interfaces (e.g. DynamicMetaData,
sqlalchemy.create_session, sqlalchemy.relation) when they add new ones.
Also letting other old interfaces (e.g. meta.connect) bitrot even
while still present.

svn path=/trunk/packages/sipb-xen-database/; revision=946

debian/changelog
python/database/__init__.py
python/database/models.py

index c586cd1..99ee102 100644 (file)
@@ -1,3 +1,10 @@
+sipb-xen-database (10.20) hardy; urgency=low
+
+  * port to sqlalchemy-0.4, which cuts out some newly deprecated
+    interfaces and allowed some still-present interfaces to bitrot
+
+ -- Greg Price <price@mit.edu>  Mon, 29 Sep 2008 06:06:21 +0000
+
 sipb-xen-database (10.19) unstable; urgency=low
 
   * Generate config files for pg_hba.conf
index 88e5169..5eeb3c5 100644 (file)
@@ -1,6 +1,7 @@
 from invirt.config import structs as config
 from models import *
+import sqlalchemy
 
 def connect(uri = config.db.uri):
     """ Connect to a given database URI"""
-    meta.connect(uri)
+    meta.bind = sqlalchemy.create_engine(uri)
index e0a7d17..6574ff1 100644 (file)
@@ -1,4 +1,5 @@
 from sqlalchemy import *
+from sqlalchemy.orm import create_session, relation
 
 from sqlalchemy.ext.sessioncontext import SessionContext
 from sqlalchemy.ext.assignmapper import assign_mapper
@@ -23,7 +24,7 @@ __all__ = ['meta',
            'or_',
            ]
 
-meta = DynamicMetaData()
+meta = ThreadLocalMetaData()
 ctx = SessionContext(create_session)
 
 machine_table = Table('machines', meta,