Re: [Tutor] Fetching dictionaries using MySQLdb

2005-08-08 Thread Jan Eden
Hi Danny, Danny Yoo wrote on 08.08.2005: >On Mon, 8 Aug 2005, Jan Eden wrote: > >>Is there a recommended way to receive the results of an SQL query >>in the form I need? Or do I have to create a dictionary of >>fieldname tuples which can be zipped with the query result tuple? > > >Hi Jan, > >MySQ

Re: [Tutor] Fetching dictionaries using MySQLdb

2005-08-08 Thread Danny Yoo
On Mon, 8 Aug 2005, Jan Eden wrote: > Is there a recommended way to receive the results of an SQL query in the > form I need? Or do I have to create a dictionary of fieldname tuples > which can be zipped with the query result tuple? Hi Jan, MySQLdb supports the concept of customized cursor ty

Re: [Tutor] Fetching dictionaries using MySQLdb

2005-08-08 Thread Jan Eden
Kent Johnson wrote on 08.08.2005: >Jan Eden wrote: >>The documentation for MySQLdb says that fetchoneDict() is >>deprecated and the usage of fetchone() is suggested. > >You could just use fetchoneDict(); deprecated isn't the same as >gone... I tend to avoid deprecated functions/methods - I would

Re: [Tutor] Fetching dictionaries using MySQLdb

2005-08-08 Thread Kent Johnson
Jan Eden wrote: > Hi, > > in Perl's DBI, I used fetchrow_hashref() to receive a database row as > a dictionary, with the field names being the dictionary keys. > > MySQLdb's fetchone() returns a tuple Unfortunately, I have a > dictionary of SQL queries which return rows of different lengths > (re

[Tutor] Fetching dictionaries using MySQLdb

2005-08-08 Thread Jan Eden
Hi, in Perl's DBI, I used fetchrow_hashref() to receive a database row as a dictionary, with the field names being the dictionary keys. MySQLdb's fetchone() returns a tuple Unfortunately, I have a dictionary of SQL queries which return rows of different lengths (read: with a varying number of