Add multi-file model output#479
Conversation
|
@PaleNeutron thank you for your contribution. While there has been a long discussion about this request in the original issue, I feel the a file per module maybe a bit of an exaggeration. I would say a file per schema makes more sense, but feel free to counter that idea. @agronholm wdyt? |
|
@sheinbergon , we subscribe financial data into a database and the provider put about 2000 tables in one schema. Split models by schema can not solve this problem. BTW, generally schema count is less than 10 and generate each one in a loop is acceptable, no need to create a new option. |
sheinbergon
left a comment
There was a problem hiding this comment.
One smal change request
Alright, Fine by me. Submitted one small change request |
4dede94 to
03464f2
Compare
Closes #88.
This adds a CLI option for writing generated models into a directory, with one Python file per generated model:
--output-directory <dir>creates the directory if neededbase_model.py__init__.pyis created.pyfileThe generator API now also accepts
generate(multi_file=True)and returns a mapping of module names to generated source strings. Callinggenerate()without arguments preserves the existing single-file behavior.Verification:
uv run pytestuv run ruff check .