It would be really nice and helpful if it were possible to have SQLAlchemy model "split" in to separate, schema specific, files with a schema specific Base.
As an example, if a DDL had something like
CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
CREATE TABLE schema1.table1 (
...
);
CREATE TABLE schema2.table2 (
...
);
the -m sqlalchemy in combination with a new option would produce two model files,
schema1.py
schema2.py
with
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
Schema1Base = declarative_base()
class Table1(Schema1Base):
__tablename__ = "table1"
__table_args__ = {"schema": "schema1"}
and
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
Schema2Base = declarative_base()
class Table2(Schema2Base):
__tablename__ = "table2"
__table_args__ = {"schema": "schema2"}
respectively. This would be amazingly helpful & useful feature as it would make it possible to really separate the schemas.
It would be really nice and helpful if it were possible to have SQLAlchemy model "split" in to separate, schema specific, files with a schema specific Base.
As an example, if a DDL had something like
the -m sqlalchemy in combination with a new option would produce two model files,
schema1.py
schema2.py
with
and
respectively. This would be amazingly helpful & useful feature as it would make it possible to really separate the schemas.