[DB-SIG] Could someone please write a Python DB Tutorial?

Trawoeger, Andreas Andreas.Trawoeger@wgkk.sozvers.at
Thu, 23 Nov 2000 12:38:20 +0100


I started with Python DB programming three days ago and finally succeeded in
most of what I wanted to do, but I had a really hard time to get there.

My primary goal was to be able to access the SQL Database of our M$ System
Management Server from my Linux box I'm using for network monitoring. At
first I did thought this couldn't be too difficult. I just want to pass a
small SELECT statement to the SQL-Server and process the result using Python
on my Linux box.

So I started to read the Python Database API. Which gave me absolutely no
clue how to do what I wanted to do. It is a precise description of all
functions of the API, but that's it. I can give you a precise description of
the most important verbs and nouns of the German language. You will still
find yourself have a lot of troubles writing a sentence in German.

The most useful information I have found are the OdbcHints for PythonWin.
Which helped me to understand the basic DB API calls and how to solve part
of my problems on a NT box, but I hadthe additional problem of porting the
script from NT to Linux.

That's the point where I really got stuck. There is no in depth
documentation about how to use the DB API and only small hints about M$ SQL
connection on Linux on the mxODBC Homepage. It took me a 15 hour working day
including a nightly hacking session till 2am to solve my Linux -> NT
connection problem using the EasySoft ODBC<->ODBC Gateway.

I also thing that I'm going to have a hard time to use more API calls then:
connect, cursor, execute, fetchall.

So I would really like to ask you to write a short Tutorial. Giving a short
overview about all the available modules and which module you can use for
which purpose and a couple of examples how to use the Python DB API. (The
simple tip: For M$ SQL use the EasySoft ODBC Gateway could have saved me 4
hours of desperate Google searches). 

cu andreas

If you wrap the Internet around every person on the planet and spin the
planet, software flows in the network. 
- Eben Moglen's Metaphorical Corollary to Faraday's Law