I am using AWS Redshift Datashare. I can query my main redshift database from the datashare database like
select * from maindb.public.old_table limit 10;
in my IDE terminal.
However in my Python backend code, we are using the ORM structure, where we have models like
class oldTable(Model):
__tablename__ = "maindb.public.old_table”
__table_args__ = {"extend_existing": True}
views = Column(db.Text, default=dt.datetime.utcnow, primary_key=True)
In my python FLASK backend code. Setting the table name to “maindb.public.old_table” doesn’t work to query the table. I get an error
(psycopg2.errors.UndefinedTable) relation \"maindb.public.old_table\" does not exist\n\n
Could someone help me to query it in my Python backend?
I know the approach using raw SQL text works but I prefer to keep it as models, and I don’t want to restructure everything