Commits

Marcin Kuzminski committed bcb21de

try to get engine from Base if it's defined

  • Participants
  • Parent commits c86decb

Comments (0)

Files changed (1)

File alembic/templates/pylons/env.py

 
     """
 
-    connection = meta.engine.connect()
+    if hasattr(meta, 'engine'):
+        connection = meta.engine.connect()
+    elif hasattr(meta, 'Base'):
+        connection = meta.Base.metadata.bind.connect()
+    else:
+        raise Exception(('Unable to fetch connection from meta %s'
+                         'Try to define engine or Base in meta file') % meta)
     context.configure(
                 connection=connection,
                 target_metadata=target_metadata