AttributeError: 'MetaData' object has no attribute 'engine'

1,090 views
Skip to first unread message

jo

unread,
Jul 10, 2009, 8:30:17 AM7/10/09
to sqlal...@googlegroups.com
Hi all,

I'm trying migrate from 0.3.10 to 0.4 and there's the following error:

... engine = database.metadata.engine
AttributeError: 'MetaData' object has no attribute 'engine'

I was reading the section "0.3 to 0.4 Migration" of
http://www.sqlalchemy.org/docs/04/intro.html#overview_migration,
but sincerly I didn't understand where engine is rigth now.

---------------------------------------------------------------------

this is my old code:
---------------------------------------------------------------------
from turbogears import database
from sqlalchemy import *
from sqlalchemy.ext.assignmapper import assign_mapper
from sqlalchemy.ext.selectresults import SelectResultsExt
database.bind_meta_data()
session = database.session
engine = database.metadata.engine
context = database.session.context

user=Table('user',database.metadata,
Column('code', Unicode(6),primary_key=True,nullable=False),
Column('name', Unicode(200)),
Column('address', Unicode(200)),
)

Please help me to migrate this code to 0.4.

j

phrr...@googlemail.com

unread,
Jul 10, 2009, 9:10:31 AM7/10/09
to sqlalchemy
I think you should be able to say metadata.bind = engine

pjjH

Michael Bayer

unread,
Jul 10, 2009, 9:44:07 AM7/10/09
to sqlal...@googlegroups.com
its metadata.bind . the 0.4 transition guide at
http://www.sqlalchemy.org/trac/wiki/WhatsNewIn04 mentions it but it's not
as clearly written as it should be.
Reply all
Reply to author
Forward
0 new messages