Generate Django models

If Django is installed on the path then using django as the model will run the
generated ddl through Django’s inspectdb management command to produce a model
file:

$ ddlgenerator django '[{"Name": "Alfred", "species": "wart hog", "kg": 22}]'
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.
from __future__ import unicode_literals
from django.db import models
class Table0(models.Model):
species = models.CharField(max_length=8)
kg = models.IntegerField()
name = models.CharField(max_length=6)
class Meta:
managed = False
db_table = 'Table0'

Large tables

As of now, ddlgenerator is not well-designed for table sizes approaching
your system’s available memory.

One approach to save time and memory for large tables is to break your input data into multiple
files, then run ddlgenerator with --save-metadata against a small
but representative sample. Then run with --no-creates and -use-saved-metadata
to generate INSERTs from the remaining files without needing to re-determine the
column types each time.