[PYTHON DB-SIG] API conformant sybase module

Glenn T. Colby gtc@cognos.informatics.jax.org
Wed, 8 Jan 1997 09:31:16 -0500 (EST)


This reminds me, I made a few changes to the sybasemodule that you were
using at The Jackson Lab so that it returns tuples instead of
dictionaries, along with one tuple that contains the column names.  To my
surprise, there was no performance gain/loss.  It seems natural to return
tuples to me now, since there is so much space overhead when returning a
dictionary for each row in the database.  Since our database has grown so
much, we started running out of swap space, etc., when returning

On top of our sybasemodule now we have a class that processes query
results -- I found no real benefit in using dictionaries over tuples in
that class.  Doing a dictionary key lookup is not much different than
doing some kind of enumeration.

For now, our sybasemodule returns dictionaries, but in our next release it
will return tuples because of space concerns.



On Wed, 8 Jan 1997, David Walton wrote:

> Hi,
> I don't mean to change the subject, but while there is some 
> activity I'd like to ask a question.  Why was it decided for the
> API to return a list of tuples?  At my previous place of employment
> (the Jackson Labortory on the Mouse Genome Database Project), we
> were using one of the early Sybase modules, hacked to our own
> specification (read pre-DBAPI).  It always seemed natural to us
> to have rows from the database returned as dictionaries.
> As a result when I started working with the mSQL module, and more
> recently the Oracle module (both of which are great btw!  Thanks to
> those who developed them!) at my current job, it was a suprise
> to me to find that there was no option for returning a list of
> dictionaries.  I altered the mSQL module to add this function
> (and notified it's maintainer), and added a python function to
> my own Oracle library, that acts as an interface to the Oracle
> module, to convert rows to dictionaries if the caller so desires.
> I don't mind the way I've done it, though it seems less efficient
> in the case of Oracle to be converting rows to a different data
> structure once in Python, instead of in the Oracle module itself.
> I would be interested in hearing why it isn't part of the API, and
> peoples' thoughts on the value of this functionality.  I've always
> found it very useful.
> Thanks!
> Dave Walton
> Scientific Software Engineer
> AlphaGene, Inc.
> david@alphagene.com
> =================
> DB-SIG  - SIG on Tabular Databases in Python
> send messages to: db-sig@python.org
> administrivia to: db-sig-request@python.org
> =================


| Glenn T. Colby          | Join the Python Software Activity!        |
| The Jackson Laboratory  |                                           |
| gtc@informatics.jax.org | See this URL:  http://www.python.org/psa/ |

DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org