datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Django models as output

Open briceparent opened this issue 10 months ago • 0 comments

Hello! Thanks for this awesome project!

I was wondering what would be the path to generate a new ouput format, which would be made of valid Django models (using Django's ORM). Do you foresee any major issue that would make this hard to achieve? If I can find some time, I'd happily try to work on it, I know Django quite well, but as I'm just starting to use this package, I'm not yet aware of the complexity to achieve such a goal.

Is your feature request related to a problem? Please describe. Django's ORM is quite popular, and allowing to generate models would help me automate the integration of some open data with a json schema format into relational databases. It would also allow the use of Django's migration system to quickly update the database with few human actions, if any. It also allows to use the many tools available to see and use the database (like external packages or the Django admin).

Describe the solution you'd like I'd like a little bit of guiding, especially for the method to employ to decide which field types (for example) to use, how the relations work, and how to pass such data to the templating system. Or if someone has already worked on this, his feedback on the project, as maybe it's not a new idea but it's just not feasible.

Describe alternatives you've considered I've considered trying to use this package as an intermediary step, generating a simple formatted file, that I could use with an external tool to generate the Django models. But the extra step seems to add complexity more than anything else.

briceparent avatar Jan 16 '25 15:01 briceparent