Skip to content Skip to sidebar Skip to footer

Sqlalchemy.exc.argumenterror: Error Creating Backref

i am trying to scrape data and store into database but its showing an error sqlalchemy.exc.ArgumentError: Error creating backref 'publisher_id' on relationship 'PublisherLookup.re

Solution 1:

backref wants to create an attribute/property on the referenced table with the given name. In your case there is already a property called publisher_id. backref should not be the name of the ForeignKey column, but rather the name of the other side of the relationship. In your case it probably should be named publisher_lookup:

class PublisherLookup(DeclarativeBase):
    # ...
    reviews = relationship("Reviews", backref='publisher_lookup')

Post a Comment for "Sqlalchemy.exc.argumenterror: Error Creating Backref"