You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a database and schema in Postgres. I have my models and when I run python manager.py db migrate which uses Flask-Migrate, I get the error below. However, the db init command works.
sqlalchemy.exc.ProgrammingError: (ProgrammingError) no schema has been selected to create in
Now when I add __tablename__ and __table_args__ = {"schema": "name_of_schema"} to my models, I get the error below for both, db init and db migrate:
sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'deploy.instance_id' could not find table 'instance' with which to generate a foreign key to target column 'id'
My relationships however, look okay. I've seen many examples and they worked properly on SQLite without Flask-Migrate.
I have three tables as follows (removing most columns):
Application to Instance (one-to-many; one application many instances)
Instance to Deploy (one-to-many; one instance many deploys)
What am I doing here? Why are my relationships wrong? When I remove all relationships and create a standalone table, I still get the first error: sqlalchemy.exc.ProgrammingError: (ProgrammingError) no schema has been selected to create in.
Any help is much appreciated.
The text was updated successfully, but these errors were encountered:
I did that. I figured it out. Apart from that and setting __table_args__ = {"schema":"v1"}, the schema needs to be specified in ForeignKey such that: ForeignKey('myschema.table.id')
I did that. I figured it out. Apart from that and setting __table_args__ = {"schema":"v1"}, the schema needs to be specified in ForeignKey such that: ForeignKey('myschema.table.id')
I've created a database and schema in Postgres. I have my models and when I run
python manager.py db migrate
which uses Flask-Migrate, I get the error below. However, thedb init
command works.sqlalchemy.exc.ProgrammingError: (ProgrammingError) no schema has been selected to create in
Now when I add
__tablename__
and__table_args__ = {"schema": "name_of_schema"}
to my models, I get the error below for both,db init
anddb migrate
:sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'deploy.instance_id' could not find table 'instance' with which to generate a foreign key to target column 'id'
My relationships however, look okay. I've seen many examples and they worked properly on SQLite without Flask-Migrate.
I have three tables as follows (removing most columns):
The relationships are:
What am I doing here? Why are my relationships wrong? When I remove all relationships and create a standalone table, I still get the first error:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) no schema has been selected to create in
.Any help is much appreciated.
The text was updated successfully, but these errors were encountered: