sqlacodegen
sqlacodegen copied to clipboard
Fix Column and metadata in SQLModel Generator
I encountered a similar problem with #302 and I tried to fix it, including
- Force to use
Columninstead ofmapped_column, through passingis_table=True - Modify
generate_baseto generatemetadatavariable ifModelexists
Maybe we can also refactor generate_models to decouple the function of getting models and collecting imports.
It is probably just a temporary solution to the issue. Thus it's up to you whether to merge. Thanks.
coverage: 99.035%. remained the same when pulling d1fec1585380b1d2a5a4f87027399c4734091bdf on THUzxj:master into 6b8bc90c68c3fe162c78edb5395474c7166b1ede on agronholm:master.
I am working on a proper fix for the problem. Most of the time, Column should not be used by the generator.