Re: Querying MariaDB from python

2018-10-02 Thread Thomas Jollans
On 2018-10-02 18:07, Tony van der Hoff wrote: > On 02/10/18 16:47, Ervin Hegedüs wrote: >> hi, >> >> now rows will looks like this: >> ({'id':...,...},{'id':...,}...) > > Thanks Ervin, but: > >cursor = cnx.cursor(pymysql.cursors.DictCursor) > NameError: name 'pymysql' is not defined > > I ha

[SOLVED] Re: Querying MariaDB from python

2018-10-02 Thread Tony van der Hoff
On 02/10/18 17:13, Larry Martell wrote: > On Tue, Oct 2, 2018 at 12:09 PM Tony van der Hoff > wrote: >> >> On 02/10/18 16:47, Ervin Hegedüs wrote: >>> hi, >>> >>> now rows will looks like this: >>> ({'id':...,...},{'id':...,}...) >> >> Thanks Ervin, but: >> >>cursor = cnx.cursor(pymysql.curso

Re: Querying MariaDB from python

2018-10-02 Thread Ervin Hegedüs
Hi Tony, On Tue, Oct 02, 2018 at 05:07:38PM +0100, Tony van der Hoff wrote: > On 02/10/18 16:47, Ervin Hegedüs wrote: > > hi, > > > > now rows will looks like this: > > ({'id':...,...},{'id':...,}...) > > Thanks Ervin, but: > >cursor = cnx.cursor(pymysql.cursors.DictCursor) > NameError: nam

Re: Querying MariaDB from python

2018-10-02 Thread Larry Martell
On Tue, Oct 2, 2018 at 12:09 PM Tony van der Hoff wrote: > > On 02/10/18 16:47, Ervin Hegedüs wrote: > > hi, > > > > now rows will looks like this: > > ({'id':...,...},{'id':...,}...) > > Thanks Ervin, but: > >cursor = cnx.cursor(pymysql.cursors.DictCursor) > NameError: name 'pymysql' is not d

Re: Querying MariaDB from python

2018-10-02 Thread Tony van der Hoff
On 02/10/18 16:47, Ervin Hegedüs wrote: > hi, > > now rows will looks like this: > ({'id':...,...},{'id':...,}...) Thanks Ervin, but: cursor = cnx.cursor(pymysql.cursors.DictCursor) NameError: name 'pymysql' is not defined I have been using the mysql.connector module, which seems to be the "

Re: Querying MariaDB from python

2018-10-02 Thread Tony van der Hoff
On 02/10/18 16:37, Larry Martell wrote: > On Tue, Oct 2, 2018 at 11:34 AM Tony van der Hoff > wrote: >>I would have expected the connector to be able to return a >> dictionary. >> >> Can anyone suggest a better way of doing this? > > https://pymysql.readthedocs.io/en/latest/modules/cursors.html#

Re: Querying MariaDB from python

2018-10-02 Thread Ervin Hegedüs
hi, On Tue, Oct 02, 2018 at 04:14:45PM +0100, Tony van der Hoff wrote: > I'm writing a database application, in python 3,5 under Debian9. > > My code: > >     def get_albums(self, parent_id = 0 ): >     cursor = self.cnx.cursor() cursor = self.cnx.cursor(pymysql.cursors.DictCursor

Re: Querying MariaDB from python

2018-10-02 Thread Larry Martell
On Tue, Oct 2, 2018 at 11:34 AM Tony van der Hoff wrote: > > I'm writing a database application, in python 3,5 under Debian9. > > My code: > > def get_albums(self, parent_id = 0 ): > cursor = self.cnx.cursor() > sql =( "select" > "id" > ",