def _get_sql_model_create(model, known_models=set()):
    """
    Get the SQL required to create a single model.

    Returns list_of_sql, pending_references_dict
    """
    from django.db import backend, get_creation_module, models
    data_types = get_creation_module().DATA_TYPES

    opts = model._meta
    final_output = []
    table_output = []
    pending_references = {}
    for f in opts.fields:
        if isinstance(f, (models.ForeignKey, models.OneToOneField)):
            rel_field = f.rel.get_related_field()
            data_type = get_rel_data_type(rel_field)
        else:
            rel_field = f
            data_type = f.get_internal_type()
        col_type = data_types[data_type]
        if col_type is not None:
            # Make the definition (e.g. 'foo VARCHAR(30)') for this field.
            field_output = [style.SQL_FIELD(backend.quote_name(f.column)),
                style.SQL_COLTYPE(col_type % rel_field.__dict__)]
            field_output.append(style.SQL_KEYWORD('%sNULL' % (not f.null and 'NOT ' or '')))
            if f.unique:
                field_output.append(style.SQL_KEYWORD('UNIQUE'))
            if f.primary_key:
                field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
            if f.rel:
                if f.rel.to in known_models:
                    field_output.append(style.SQL_KEYWORD('REFERENCES') + ' ' + \
                        style.SQL_TABLE(backend.quote_name(f.rel.to._meta.db_table)) + ' (' + \
                        style.SQL_FIELD(backend.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column)) + ')' + 
                        backend.get_deferrable_sql()
                    )
                else:
                    # We haven't yet created the table to which this field
                    # is related, so save it for later.
                    pr = pending_references.setdefault(f.rel.to, []).append((model, f))
            table_output.append(' '.join(field_output))
    if opts.order_with_respect_to:
        table_output.append(style.SQL_FIELD(backend.quote_name('_order')) + ' ' + \
            style.SQL_COLTYPE(data_types['IntegerField']) + ' ' + \
            style.SQL_KEYWORD('NULL'))
    for field_constraints in opts.unique_together:
        table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \
            ", ".join([backend.quote_name(style.SQL_FIELD(opts.get_field(f).column)) for f in field_constraints]))

    full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(backend.quote_name(opts.db_table)) + ' (']
    for i, line in enumerate(table_output): # Combine and add commas.
        full_statement.append('    %s%s' % (line, len(table_output)-1 < i and ',' or ''))
    full_statement.append(');')
    final_output.append('\n'.join(full_statement))

    return final_output, pending_references
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/core/management.py/_get_sql_model_create/swapped operands of `<`