[Tutor] Python - SQL paradigm (Will I need a hammer to make it fit?)
Liam Clarke
ml.cyresse at gmail.com
Wed Dec 14 11:14:58 CET 2005
Hi all,
Just contemplating.
If in Python I were organising a data index along the lines of -
j = {
"k_word1" : ["rec1","rec2","rec3","rec4"],
...
"k_wordn" :["recX","rec4"]
}
and I was going to find records that matched by seeing what record
occurred in the most lists (via set intersections or similar; going to
have a play see what works faster) selected by searching keywords...
how easily does that translate to a SQL table and query format?
If I had columns
k_word1 ... k_wordn
rec1 recX
rec2 rec4
rec3
rec4
is that even valid? Or does every row have to have a primary key?
I've been looking at sqlcourse.com, and I'm thinking of having a table
for each keyword, and adding each record as a primary key on that
table.
i.e.
table k_word1
prim_key_unique
rec1
rec2
rec3
rec4
And then querying each table for that primary key and then once again,
return results in order of number of matches to keywords.
Have I aroused anyone's Code Smell nose yet?
Regards,
Liam Clarke
More information about the Tutor
mailing list