My guess is Session.bind has not been initialized?
Perhaps you need to call init_model which id defined in model/
__init__.py first? See its definition here :-
def init_model(engine):
"""Call me before using any of the tables or classes in the
model"""
Session.configure(bind=engine)
On Jun 5, 11:58 am, Victor <[email protected]> wrote:
> I'm following the PylonsHQ Documentation on
> models:http://pylonshq.com/docs/en/1.0/models/
>
> I have managed to follow the docs until the portion where I am trying
> to create the database. The code I add to websetup.py is as follows:
>
> from myapp.model.meta import Base, Session
> log.info("Creating tables")
> Base.metadata.drop_all(checkfirst=True, bind=Session.bind)
> Base.metadata.create_all(bind=Session.bind)
> log.info("Successfully setup")
>
> When I run "$ paster setup-app development.ini" command, I get the
> following error:
>
> 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.
>
> I am using a MySQL server running on an Ubuntu machine to try out the
> example.
>
> Does anybody know why I am getting the error?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.