3 # recreate the pickle file db-metadata-*.pkl that needs to be updated
4 # after a database upgrade
6 from sqlalchemy import create_engine, __version__
10 from os.path import abspath, dirname
12 DAK_TEST_DIR = dirname(abspath(__file__))
13 DAK_ROOT_DIR = dirname(DAK_TEST_DIR)
14 if DAK_ROOT_DIR not in sys.path:
15 sys.path.insert(0, DAK_ROOT_DIR)
17 from daklib.dbconn import DBConn
19 pickle_filename = '%s/fixtures/db-metadata-%s.pkl' % (DAK_TEST_DIR, __version__)
20 pickle_file = open(pickle_filename, 'w')
21 metadata = DBConn().db_meta
22 pickle.dump(metadata, pickle_file)
23 pickle.dump(metadata.ddl_listeners, pickle_file)
25 print "File %s has been updated successfully." % pickle_filename