Commits

Rufus Pollock  committed 933b31a

[changeset][xs]: pass in mapper to setup_changeset.

  • Participants
  • Parent commits c25897f
  • Branches changeset

Comments (0)

Files changed (2)

File vdm/sqlalchemy/changeset.py

 
     return (changeset_table, change_object_table)
 
-def setup_changeset(metadata):
+def setup_changeset(metadata, mapper):
     changeset_table, change_object_table = make_tables(metadata)
-    from sqlalchemy.orm import mapper
     mapper(Changeset, changeset_table, properties={
         'manifest': relationship(ChangeObject, backref='changeset',
             collection_class=column_mapped_collection(change_object_table.c.object_id))

File vdm/test/sqlalchemy/test_changeset.py

 import json
 from sqlalchemy import *
-from sqlalchemy.orm import scoped_session, sessionmaker, create_session
+from sqlalchemy.orm import scoped_session, sessionmaker, create_session, mapper
 
 from vdm.sqlalchemy.changeset import *
 Session = scoped_session(
     def setup_class(self):
         engine = create_engine('sqlite://')
         metadata = MetaData(bind=engine)
-        setup_changeset(metadata)
+        setup_changeset(metadata, mapper)
         metadata.create_all()
 
     def test_01(self):