dimanche 30 juillet 2017

SQLAlchemy doesn't map reflected class

I have this code:

def advertiser_table(engine):
    return Table('advertiser', metadata, autoload=True, autoload_with=engine)

And later I try this:

advertisers = advertiser_table(engine)
...
session.bulk_insert_mappings(
        advertisers.name,
        missing_advetisers.to_dict('records'),
    )

where missing_adverisers is a Pandas DataFrame (but it's not important for this question).

The error this gives me is:

sqlalchemy.orm.exc.UnmappedClassError: Class ''advertiser'' is not mapped

From reading the documentation I could scramble enough to ask the question, but not much more than that... What is Mapper and why is it so detrimental to the functioning of this library?.. Why isn't "the class" mapped? Obviously, what am I to do to "map" it to whatever this library wants it to map?





Aucun commentaire:

Enregistrer un commentaire