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
-
In fact, I found that there are some problems in the code generated by
sqlacodegen
forsqlmodel
, which is manifested in the introduction of redundant classCHAR
and themapped_column
does not been import. The following is a detailed description of the problem:(1) When encountering
CHAR(36)
andCHAR(36, 'utf8mb4_general_ci')
,sqlacodegen
will 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)
sqlmodel
does not supportmapped_column
in the latest release(https://github.com/fastapi/sqlmodel/releases/tag/0.0.22), although someone has proposed a PR (fastapi/sqlmodel#1143), soColumn
should be used for the generation of sqlmodels for the time beingBeta Was this translation helpful? Give feedback.
All reactions