Replies: 2 comments
-
Adding metadata with schema information should fix it.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
This seems to work: from typing import Optional
from sqlmodel import Field, SQLModel, select
from sqlalchemy.dialects import mssql
class test_sqlmodel(SQLModel, table=True):
__table_args__ = {"schema": "XYZ"}
id: Optional[int] = Field(default=None, primary_key=True)
name: str
statement = select(test_sqlmodel)
print(statement.compile(dialect=mssql.dialect()))
# SELECT [XYZ].test_sqlmodel.id, [XYZ].test_sqlmodel.name
# FROM [XYZ].test_sqlmodel |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
When I run the example code, it works as long as my table
test_sqlmodel
exists in the default schema. But, how can I create a sql model that points to a different one?Operating System
Linux
Operating System Details
Red Hat 7
SQLModel Version
0.0.4
Python Version
Python 3.8.10
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions