The MetaData is not bound to an Engine or Connection.

1,891 views
Skip to first unread message

rakesh agarwal

unread,
Aug 19, 2011, 5:33:53 AM8/19/11
to pylons-...@googlegroups.com
How to resolve the following error:

File "/home/rakesh/pylon/SimpleSite/simplesite/websetup.py", line 23, in setup_app
    Base.metadata.create_all(bind=Session.bind)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/schema.py", line 2012, in create_all
    bind = _bind_or_error(self)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/schema.py", line 2464, in _bind_or_error
    raise exc.UnboundExecutionError(msg)

sqlalchemy.exc.UnboundExecutionError: The MetaData is not bound to an Engine or Connection.  Execution can not proceed without a database to execute against.  Either execute with an explicit connection or assign the MetaData's .bind to enable implicit execution.


--
Thanks and Regards,
Rakesh Kumar Agarwal,


Michael Merickel

unread,
Aug 19, 2011, 11:08:24 AM8/19/11
to pylons-...@googlegroups.com
First of all this belongs in the SQLAlchemy mailing list.

I'm guessing that you have not setup your Session object with the engine yet, so "bind=Session.bind" is just binding to None.

Wherever you are initializing your engine you'll want to be doing

engine = engine_from_config(...)
Session.configure(bind=engine)

--

Michael
Reply all
Reply to author
Forward
0 new messages