tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.39k stars 357 forks source link

MSSQLSchemaGenerator does not support creating tables in non-default (dbo) database schemas #1531

Open cbieberstein-secure opened 6 months ago

cbieberstein-secure commented 6 months ago

Is your feature request related to a problem? Please describe. I would like to use Tortoise to integrate with an existing application who's data is stored in MSSQL Server. However it makes use of multiple schemas (eg. control.table, sales.table) but tortoise can only map to dbo.*

Describe the solution you'd like ideally there should be a META parameter db_schema that could be mapped into the templates something like this:

TABLE_CREATE_TEMPLATE = "CREATE TABLE [{db_schema}].[{table_name}] ({fields}){extra};"

Describe alternatives you've considered

Additional context