-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for registering custom converters #93
Comments
Hi, Thanks for the suggestion. |
I've created a PR for SQLModel support, but I think this will solve the issue here too. Basically this will enable classes inheriting from |
Nice! However the PR does break
One benefit of being able to register custom converters is so that you can bypass the usual |
It seems this issue has not been solved yet, right? I need to add my converter to support the custom column types. @aminalaee ref. #176. |
@okapies After the PR was merged you should be able to override this behaviour by setting |
Thanks, I'll try it. IMHO, I think it may be useful if |
Checklist
Is your feature related to a problem? Please describe.
There doesn't seem to be an obvious way to register converter functions with
@converts
or subclassModelConverter
.This might also be a bug where
ModelConverterBase.get_converter
is unable to recognizeTypeDecorator
types that extend a type that already has a converter.Describe the solution you would like.
Possibly utilizing a global registry for
@converts
.Describe alternatives you considered
No response
Additional context
Encountered while trying to create a
ModelAdmin
for aSQLModel
(related to #57)Exception: Could not find field converter for column name (<class 'sqlmodel.sql.sqltypes.AutoString'>).
whereAutoString
extendsString
EDIT:
Got it to work by setting the
sa_column=
on the SQLModel field:I believe the feature request still has value
The text was updated successfully, but these errors were encountered: