mjsting33
mjsting33

Reputation: 13

sqlAlchemy mapper not defined

I am getting the following error message:

Traceback (most recent call last):
File "alchemyTest.py", line 12, in <module>
planetMapper = mapper(Planet, planet)
NameError: name 'mapper' is not defined

My SQLAlchemy version is 1.0.12. I am using the following code:

connection = db.connect();
metadata = MetaData(db);

class Planet(object):
    pass

planet = Table('PLANET', metadata, autoload=True)
planetMapper = mapper(Planet, planet)

I have searched online and have not been able to find anything on mapper not being defined. Any help is appreciated.

Upvotes: 0

Views: 1145

Answers (1)

jotaelesalinas
jotaelesalinas

Reputation: 1497

from sqlalchemy.orm import mapper

Upvotes: 1

Related Questions