I’m trying to set the Schema for Microsoft SQL Server at runtime, the problem I’m having is setting the schema variable before the class is loaded:
class table(Base):
__tablename__ = "table"
__table_args__ = {'schema': schema_name}
id = mapped_column(UNIQUEIDENTIFIER, primary_key=True)
created = mapped_column(DateTime)
.....
I’ve tried calling a function which creates the schema this doesn’t seem to work and MSSQL doesn’t support set schema, I just want to be able to import the database script and the schema before the class is loaded or modify it at run time, is this possible in Python3? (I have many tables for which the schema is pulled from a config file)
I load the database file by calling
import mydbfile