-
-
Notifications
You must be signed in to change notification settings - Fork 754
Closed
Labels
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the SQLModel documentation, with the integrated search.
- I already searched in Google "How to X in SQLModel" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to SQLModel but to Pydantic.
- I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- I commit to help with one of those options 👆
Example Code
name: str = Field(
sa_column=Column(
String,
# ... other attrs not exposed in sqlmodel.Field today
),
index=True # this is ignored, must be set on `Column` above
)
Description
sqlmodel.Field
exposes some but not all fields from sqlalchemy.Column
. This means in some cases it is necessary to provide a Column
via the sa_column=
param on sqlmodel.Field
. However, when this is the case the parameters set on sqlmodel.Field
are not forwarded to the new sa_column
object.
I think the expected behavior here is that parameters set on Field
would be combined with those from the sa_column
object. Either this or setting a parameter that will be ignored should trigger a warning/exception along the lines of "You have set index but also provided a sqlalchemy.Column object, index will be ignored"
.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
3.9.5
Additional Context
No response
klimeryk