Sunday, January 30, 2011

Re: working django with existing database

You didn't specify more details about Oracle version that you're using but
from my experience with inspectdb and Oracle are not good ones, even though it
works or at least with databases I've tried it with.

I've decided - specially for Oracle to do it always by hand. That way, even it
seems a slightly more work you get models right from the start, not the some
barebone that you can modify.

"But I've 300 models" you say. I greatly suspect that you write an application
(or even bunch of applications) that takes advantages of even fraction of
those models in a short time. So you really need only a few of them and can
easily add new ones as you go.

Also finding things like m2m relations are not easy to do automatically, though
not possible.

--

Jani Tiainen

On Monday 31 January 2011 07:20:50 arief nur andono wrote:
> sorry for undetail, i use oracle
>
> this is output example from my inspectdb, this is one of 300 table i have
>
> from django.db import models
>
> class TempJmlGangguanPyl(models.Model):
> singkatpyl = models.CharField(max_length=4, blank=True)
> singkatgrd = models.CharField(max_length=4, blank=True)
> jumlah_gangguan = models.DecimalField(null=True, max_digits=0,
> decimal_places=-127, blank=True)
> lama_gangguan = models.DecimalField(null=True, max_digits=0,
> decimal_places=-127, blank=True)
> class Meta:
> db_table = u'temp_jml_gangguan_pyl'
>
> class TempJmlGangguanWilayah(models.Model):
> kodeupp = models.CharField(max_length=2, blank=True)
> singkatgrd = models.CharField(max_length=4, blank=True)
> jumlah_gangguan = models.DecimalField(null=True, max_digits=0,
> decimal_places=-127, blank=True)
> lama_gangguan = models.TextField(blank=True)
> class Meta:
> db_table = u'temp_jml_gangguan_wilayah'
>
> class TempPylAkhir(models.Model):
> singkatpyl = models.CharField(max_length=4, blank=True)
> nolanggan = models.CharField(max_length=12, blank=True)
> nama = models.CharField(max_length=30, blank=True)
> alamat = models.CharField(max_length=50, blank=True)
> singkatgrd = models.CharField(max_length=4, blank=True)
> notiangtr = models.CharField(max_length=29, blank=True)
> golongantarip = models.CharField(max_length=4, blank=True)
> daya = models.IntegerField(null=True, blank=True)
> jumlah_gangguan = models.DecimalField(null=True, max_digits=0,
> decimal_places=-127, blank=True)
> lama_gangguan = models.DecimalField(null=True, max_digits=0,
> decimal_places=-127, blank=True)
> kelas_slk = models.IntegerField(null=True, blank=True)
> class Meta:
> db_table = u'temp_pyl_akhir'
>
> actually the real table name is beban_harian_trafogi_teg
>
> and this is a small part errors that django says when i python manage.py
> syncdb
>
> simdis.tempjmlgangguangrd: "jumlah_gangguan": DecimalFields require a
> "max_digits" attribute that is a positive integer.
> simdis.tempjmlgangguangrd: "lama_gangguan": DecimalFields require a
> "decimal_places" attribute that is a non-negative integer.
> simdis.tempjmlgangguangrd: "lama_gangguan": DecimalFields require a
> "max_digits" attribute that is a positive integer.
> simdis.tempjmlgangguanpyl: "jumlah_gangguan": DecimalFields require a
> "decimal_places" attribute that is a non-negative integer.
> simdis.tempjmlgangguanpyl: "jumlah_gangguan": DecimalFields require a
> "max_digits" attribute that is a positive integer.
> simdis.tempjmlgangguanpyl: "lama_gangguan": DecimalFields require a
> "decimal_places" attribute that is a non-negative integer.
> simdis.tempjmlgangguanpyl: "lama_gangguan": DecimalFields require a
> "max_digits" attribute that is a positive integer.
> simdis.tempjmlgangguanwilayah: "jumlah_gangguan": DecimalFields require a
> "decimal_places" attribute that is a non-negative integer.
> simdis.tempjmlgangguanwilayah: "jumlah_gangguan": DecimalFields require a
> "max_digits" attribute that is a positive integer.
> simdis.temppylakhir: "jumlah_gangguan": DecimalFields require a
> "decimal_places" attribute that is a non-negative integer.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment