The problem specifically is that I can create the type of data found in the Django database using python, is that the model I have Django, there BigIntegerField, IntegerField and DecimalField but I can not make the same kind of data using python, the idea is to make my python code automatically update the database, here the code:
Django Model
unidad = models.BigIntegerField(max_length=15)
pin = models.IntegerField(max_length=2)
fecha = models.DecimalField(max_digits=7,decimal_places=1)
Python execute
cursor.execute('''create table u_%(table_name)s stocks (id integer AUTO_INCREMENT NOT NULL PRIMARY KEY,id_unidad bigint NOT NULL, pin integer NOT NULL, fecha numeric(7, 1) NOT NULL)''' % dict(table_name = table_name))
This is the output of Django when I run “python manage.py sql gprs”
BEGIN;
CREATE TABLE `evento` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`unidad` bigint NOT NULL,
`pin` integer NOT NULL,
`fecha` numeric(7, 1) NOT NULL
)
Your question is kind of confusing. To see the actual sql that django uses to create your model prior to executing
python manage.py syncdb, you can usepython manage.py sql appnameas documented here:https://docs.djangoproject.com/en/dev/ref/django-admin/#sql-appname-appname