In a flask application, I have a user table in multiple schemas. I can list the users inside a schema by specifying the schema in the model using __table_args__
class User(db.Model):
__table_args__ = {"schema": "schema1"} #fetch the user table in "schema1" schema
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow)
name = db.Column(db.String)
But I have no idea to change the schema name dynamically. How to change the schema name by passing a string from the controller?