Skip to content
Discussion options

You must be logged in to vote

Hi -

there's a lot of text here but the first thing I see in the code is something that likely needs to change:

class TableA(db.Model):
    __tablename__ = 'table_a'
    __table_args__ = {"schema": "public"}
    
    id = db.Column(db.Integer, primary_key=True)
    table_b_id = db.Column(db.Integer, db.ForeignKey('schema_b.table_b.id'))
    table_c_id = db.Column(db.Integer, db.ForeignKey('public.table_c.id'))

PostgreSQL database defines the default schema search path as essentially "public", meaning the name "public" is known in SQLAlchemy as the default schema. It will get confused if you name this schema explicitly in your models, so you should remove the name "public" here.

See the fo…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jhamer8
Comment options

@bojanbg
Comment options

@CaselIT
Comment options

Answer selected by jhamer8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1675 on June 08, 2025 20:22.