Hi,

I have an "interesting" problem here - in a given mysql database
scheme some sql wizard used comma-separated values in a text-field and
with that values lookups have to be done. The data itself is simple
numbers like 1,34,25,66,78,134 and so on. So what I have is something
like this:

id | username | groups         | more...
---------------------------------------------
1 | name        | 1,23,4,55,6  | ...
2 | name2      | 3,2,4,5        | ...

The groups string can be very long. there is also a table "groups"
with "id, name", as expected.

Yes, this is bad design. No, I can not immediately change the design,
I will try to, but atm I have to handle the situation as it is.

Of course normally this would be solved with an intersection table and
a many-to-many relation. For anybody interested: there is a book by
Bill Karwin called "SQL Antipatterns" - he names the described design
Jaywalking and it is the first antipattern in the book. I was
surprised to find it in real life....

So my question is: how to handle this with django? I really would
like to use django to build a nice management interface on top of that
tables, but currently I do not know how to go on with that jaywalking
antipattern in my way.

My first idea was to create my own intersection table - but the
process of [re-]converting data does only work in a
static environment - the data is heavily used and so
transformations of tabledata would be neccassery on every request to
mirror the live situation...too slow! So I am looking for a good way
to
implement some kind of layer that would translate this field for
django into an intersaection table so that I can use models - will
this work?

What do you think? How to handle this?

Thank you very much for your attention!
Snaky

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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