sqlacodegen icon indicating copy to clipboard operation
sqlacodegen copied to clipboard

Fix Column and metadata in SQLModel Generator

Open THUzxj opened this issue 2 years ago • 2 comments

I encountered a similar problem with #302 and I tried to fix it, including

  • Force to use Column instead of mapped_column, through passing is_table=True
  • Modify generate_base to generate metadata variable if Model exists

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.

THUzxj avatar Dec 01 '23 03:12 THUzxj

Coverage Status

coverage: 99.035%. remained the same when pulling d1fec1585380b1d2a5a4f87027399c4734091bdf on THUzxj:master into 6b8bc90c68c3fe162c78edb5395474c7166b1ede on agronholm:master.

coveralls avatar Dec 01 '23 03:12 coveralls

I am working on a proper fix for the problem. Most of the time, Column should not be used by the generator.

agronholm avatar Dec 01 '23 08:12 agronholm