# Patch in support for the debversion field type so that it works during
# reflection
-class DebVersion(sqltypes.Text):
- """
- Support the debversion type
- """
-
+try:
+ # that is for sqlalchemy 0.6
+ UserDefinedType = sqltypes.UserDefinedType
+except:
+ # this one for sqlalchemy 0.5
+ UserDefinedType = sqltypes.TypeEngine
+
+class DebVersion(UserDefinedType):
def get_col_spec(self):
return "DEBVERSION"
+ def bind_processor(self, dialect):
+ return None
+
+ def result_processor(self, dialect):
+ return None
+
sa_major_version = sqlalchemy.__version__[0:3]
if sa_major_version in ["0.5", "0.6"]:
from sqlalchemy.databases import postgres
################################################################################
-__all__ = ['IntegrityError', 'SQLAlchemyError']
+__all__ = ['IntegrityError', 'SQLAlchemyError', 'DebVersion']
################################################################################
# recreate the pickle file db-metadata-*.pkl that needs to be updated
# after a database upgrade
-from daklib.dbconn import DBConn
-
from sqlalchemy import create_engine, __version__
import pickle
+import sys
from os.path import abspath, dirname
DAK_TEST_DIR = dirname(abspath(__file__))
+DAK_ROOT_DIR = dirname(DAK_TEST_DIR)
+if DAK_ROOT_DIR not in sys.path:
+ sys.path.insert(0, DAK_ROOT_DIR)
+
+from daklib.dbconn import DBConn
+
pickle_filename = '%s/fixtures/db-metadata-%s.pkl' % (DAK_TEST_DIR, __version__)
pickle_file = open(pickle_filename, 'w')
metadata = DBConn().db_meta