You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question 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
fromsqlmodelimportSQLModelfromsqlalchemyimportTEXT# Written in pydantic v2 code# Option 1classModel(SQLModel):
model_config=ConfigDict(type_mapping={str: TEXT})
string_field: str# Option 2classModel(SQLModel):
string_field: str=Field(mapped_type=TEXT)
Description
I'm looking for a way to use TEXT instead of VARCHAR for existing database applications.
It looks like option 2 is the easier one to implement, since you don't have to change the argument list of def get_sqlalchemy_type
However, option 1 is easier for the user, since they only have to specify it once in a base model.
What do you think? I can take a stab at implementing either one--or both.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
I'm looking for a way to use TEXT instead of VARCHAR for existing database applications.
It looks like option 2 is the easier one to implement, since you don't have to change the argument list of
def get_sqlalchemy_type
However, option 1 is easier for the user, since they only have to specify it once in a base model.
What do you think? I can take a stab at implementing either one--or both.
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.16
Python Version
3.11.1
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions