Saturday, March 31, 2012

Re: integer array in django models

On Sat, 31 Mar 2012 18:27:56 +0530, dummyman dummyman
<tempovan@gmail.com> declaimed the following in
gmane.comp.python.django.user:

> Which model field in django is used to represent an integer array in mysql ?

To my knowledge: NONE

So far as I recall, MySQL does not have an extended data type
"array". Neither do most normal relational database engines (the only
one I know that does have an array type is PostgreSQL, and that probably
goes back to the preSQL PostGres days).

Representation of an array is done by normalizing the data. Instead
of one table (relation)
ID, someDiscrete, {an, array, of, values}
you create two tables by normalization
ID, someDiscrete
and
ID, foreignID, optionalIndex, value
ie:
x, someDiscrete
and
m, x, 1, an
m+1, x, 2, array
m+3, x, 3, of
m+4, x, 4, values
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

--
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