Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22201

Re: Documentation, assignment in expression.

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Documentation, assignment in expression.
Date 2012-03-26 12:16 -0400
Organization > Bestiaria Support Staff <
References (3 earlier) <4F6F1792.1060709@tim.thechases.com> <CAPTjJmpnYxZkLGQ4Tksw-2aaG5KAgPwoUe0EP8_OW8MdsijPdA@mail.gmail.com> <4F6F222F.7050406@tim.thechases.com> <mailman.974.1332716353.3037.python-list@python.org> <jkpsfh$s7p$1@r03.glglgl.gl>
Newsgroups comp.lang.python
Message-ID <mailman.1012.1332778626.3037.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, 26 Mar 2012 15:54:52 +0200, Thomas Rachel
<nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
declaimed the following in gmane.comp.python.general:

> Am 26.03.2012 00:59 schrieb Dennis Lee Bieber:
> 
> > If you use the longer form
> >
> > con = db.connect()
> > cur = con.cursor()
> >
> > the cursor object, in all that I've worked with, does function for
> > iteration
> 
> I use this form regularly with MySQLdb and am now surprised to see that 
> this is optional according to http://www.python.org/dev/peps/pep-0249/.
> 
> So a database cursor is not required to be iterable, alas.
>

	Sounds like it may be time to do a survey...

	MySQLdb		iterable cursor
					Cursor, DictCursor, SSCursor, SSDictCursor (the
first two suck the entire result set to the client and then feed it to
the application, the latter two keep the results on the server and fetch
them as needed; the Dict versions obviously return dictionaries, the
others return tuples)

	SQLite3 		iterable cursor
					Dictionary-like cursor using a row-factory (in
Python 2.5 documentation: 13.13.6.2 Accessing columns by name instead of
by index )

	Psycopg		iterable cursor
					dictionary-like cursor
http://initd.org/psycopg/docs/extras.html#connection-and-cursor-subclasses

	Pygresql 		iterable cursor
					dictresult() ?

	py-postgresql	unknown -- the only documentation I found appears to
be for the NON-DB-API interface
					Row object supports index or key access

	pypgsql		NOT iterable (based on readme and source)
					Result object supports index or key access

	Can anyone add to this? mxODBC, pyodbc, M$ SQL server?

	One thing I note in the above is that ALL of those adapters have
built-in means of accessing return data as a dictionary, so the OP's
generator function to create dictionary values is likely superfluous,
and may even be a bottleneck in processing.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Documentation, assignment in expression. Alexander Blinne <news@blinne.net> - 2012-03-23 23:59 +0100
  Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-23 21:09 -0400
    Re: Documentation, assignment in expression. Alexander Blinne <news@blinne.net> - 2012-03-25 14:18 +0200
      Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-25 08:03 -0500
        Re: Documentation, assignment in expression. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-26 05:36 +0000
          Re: Documentation, assignment in expression. Terry Reedy <tjreedy@udel.edu> - 2012-03-26 12:00 -0400
        Re: Documentation, assignment in expression. Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-03-26 15:59 +0200
          Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-26 12:42 -0500
      Re: Documentation, assignment in expression. Chris Angelico <rosuav@gmail.com> - 2012-03-26 00:11 +1100
      Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-25 08:48 -0500
        Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-25 17:16 +0200
          Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-25 13:22 -0500
          Re: Documentation, assignment in expression. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-26 05:47 +0000
          Re: Documentation, assignment in expression. Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-03-26 04:52 -0400
            Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 12:56 +0200
              Re: Documentation, assignment in expression. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-03-26 14:13 +0300
                Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 13:58 +0200
        Re: Documentation, assignment in expression. rusi <rustompmody@gmail.com> - 2012-03-25 09:17 -0700
        Re: Documentation, assignment in expression. mwilson@the-wire.com - 2012-03-25 19:09 -0400
          Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-25 22:29 -0400
            Re: Documentation, assignment in expression. mwilson@the-wire.com - 2012-03-26 07:27 -0400
      Re: Documentation, assignment in expression. Chris Angelico <rosuav@gmail.com> - 2012-03-26 01:11 +1100
        Re: Documentation, assignment in expression. Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-25 17:17 +0200
      Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-25 18:59 -0400
        Re: Documentation, assignment in expression. Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-03-26 15:54 +0200
          Re: Documentation, assignment in expression. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-26 12:16 -0400
      Re: Documentation, assignment in expression. Tim Chase <python.list@tim.thechases.com> - 2012-03-26 05:14 -0500
  Re: Documentation, assignment in expression. Roy Smith <roy@panix.com> - 2012-03-23 21:37 -0400

csiph-web