17.10.2012 12:15, Michał Nowotka kirjoitti:
Hello,
I have some legacy oracle database against which I run inspectdb command.
One column in the DB has type NUMBER (without precision and scale) and
what I got from django is:

entity_id = models.DecimalField(unique=True, null=True, max_digits=0,
decimal_places=-127, blank=True)

If I now run syndb trying to generate schema from the model I will get
the error:

Error: One or more models did not validate:
DecimalFields require a "decimal_places" attribute that is a
non-negative integer.
DecimalFields require a "max_digits" attribute that is a positive integer.

My question is: how should I modify entity_id type oin the model to
get NUMBER generated in oracle?

BTW. Don't you think this is bug to generate model with inspectdb
which is invalid if you run it using syncdb?

Kind regards,
Michael Nowotka


https://docs.djangoproject.com/en/1.4/ref/django-admin/#django-admin-inspectdb

As you may have read that, it states few things:

"This feature is meant as a shortcut, not as definitive model generation.". No, there is no guarantee that syncdb will work. There might be fields that canno't be mapped correctly and particulary order might be totally off.

And on top of that, there is note that inspectdb works (only) with PostgreSQL, MySQL and SQLite. No Oracle mentioned.

When I mapped my models from Oracle I used 3rd party tool MyGeneration [1] to generate mappings. It was more easier and I had full control over how to map database to Django ORM. Though ordering problem still was persstent but at least I got models more or less right from the very beginning.


[1] http://sourceforge.net/projects/mygeneration/



--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to