Replies: 1 comment
-
|
#352 can be solved |
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.
-
In fact, I found that there are some problems in the code generated by
sqlacodegenforsqlmodel, which is manifested in the introduction of redundant classCHARand themapped_columndoes not been import. The following is a detailed description of the problem:(1) When encountering
CHAR(36)andCHAR(36, 'utf8mb4_general_ci'),sqlacodegenwill repeatedly import from different sourcesThe adjustment I made was to focus on sorted and high-priority imports, and to make a warn about duplicate imports.
for example:
In fact, "from sqlalchemy import CHAR" supports general projects of multiple databases, while "from sqlalchemy.dialects.mysql import CHAR" is specifically for MySQL projects. If you project requires cross-database compatibility or you are not sure about the target database type, it is safer to use "sqlalchemy.CHAR".
(2)
sqlmodeldoes not supportmapped_columnin the latest release(https://github.com/fastapi/sqlmodel/releases/tag/0.0.22), although someone has proposed a PR (fastapi/sqlmodel#1143), soColumnshould be used for the generation of sqlmodels for the time beingBeta Was this translation helpful? Give feedback.
All reactions