Howto generlize database descriptions?

Sam Penrose sam at localhost.localdomain
Tue Sep 18 13:29:26 EDT 2001


[I post an undecipherable mess]

OK, no more editing Python files in beta email clients. The gist of what
I was trying to show was that it's pretty easy to write a wrapper class
for MySQLdb's connection object whose SELECT method(s) take a table
name, a list of fields, and a WHERE clause and return handy-dandy
dictionaries, or tuples, or what have you. It's not much more
complicated to pass dictionaries to INSERT and UPDATE methods; you just
have write code that converts:
{'field1':'value1', 'field2':'value2'}
to either:
'UPDATE table1 SET field1="value1", field2="value2" WHERE'...
or:
'INSERT INTO table1 (field1, field2) VALUES ("value1", "value2")'







More information about the Python-list mailing list