Class Bed
id
Class Guest
id
bed_assignments = relationship(
primaryjoin=(
"and_(Guest.id"
"==foreign(BedAssignment.guest_id),"
"BedAssignment.bed_status=='occupied')"
),
)
Class BedAssignment
FK Guest
FK Bed
each class is in a file and referencing Guest in BedAssignment class for the FK purpose next to referencing BedAssignment for relationship purpose creates a cross reference.
I tried using text version of FK or relationship referencing , similar to:
Column(Integer, ForeignKey("bed.id")
But it seems like a workaround as it stops alembic scripts generation that errors looking for reference.
How the cross reference be solved in this case of relationship model?