could not assemble any primary key columns for mapped table sqlalchemy 1

could not assemble any primary key columns for mapped table sqlalchemy

1. Make sure all your tables have a primary key and you set the __table__ = 'name'
2. execute the following underneath declared table models
with Session(engine) as session:
        Base.metadata.create_all(engine)
        session.commit()

Here is what the above code is Doing:
1. We’re creating a Session object, which is a class that allows us to interact with our database.
2. We’re using the Session object to create all the tables in our database.
3. We’re committing the changes to our database.

Similar Posts