Python database access questions

Limey limeydrink at hotmail.com
Fri Mar 12 06:19:29 EST 2004


Hi All,

I want to write an application that will talk to a RDBMS.

The application needs to be platform neutral from both an operating
system and database backend point of view.

I have decided to create a prototype in Python, the RDBMS will be
PostgreSQL running on a Linux box.

I am from a Microsoft background and I now take for granted components
such as ADO (Activex Data Objects) that make database access simple
and portable.

I have been looking at the Python DB-API modules and this seems to
make it relatively simple to access a RDBMS but it seems to be at a
lower level than say ADO and I feel this may potentially cause me more
work to prevent potential problems that I may encounter.

Let me explain...

ADO allows you to reference field objects when manipulating records
retrieved from the database, this makes your code less likely to be
broken by reordering of the columns of say a "select * from table"
query, it also allows you to get information on the datatypes of the
fields and so on.

ADO also provides a safer way to pass information when using parameter
queries or stored procedures, you have a parameter object that you can
assign parameter values to and any problems such as "' " /" within the
string are then handled by the objects to prevent breakage of the sql
statement passed to the RDBMS.

ADO allows you to create a "recordset" that allwos you to iterate
through the records and columns and also then assign values to the
field objects within and update these changes with method calls, it
seems all this type of stuff needs to be manually done with DB-API
i.e. you would have to create all the DML statements for this.

What are your views on this, it may just be me being naive as I only
know of the Microsoft way of doing things ;-), you may find
technologies such as ADO  cumbersome and/or restrictive ?

Any views on this matter would be greatly appreciated :-)



More information about the Python-list mailing list