Newbie Wondering About Database Support?

Bill Tate tatebll at aol.com
Wed Dec 19 09:56:32 EST 2001


richardkessler at matteicos.com (Richard Kessler) wrote in message news:<u1v8qtaje19rd2 at corp.supernews.com>...
> I have recently discovered Python and am excited about the possibility of 
> developing with the language. Unfortunately, I develop database centric 
> applications, MS SQL Server, etc. and I do not see much talk about Python and 
> access to databases. Am I missing something or is Python not intended for that 
> purpose. I would love to replace programs currently in VB with Python, but 
> they must be able to access databases.
> 
> Thanks in advance.
> 
> Richard

ODBC and ADO worked very well with Python (not the only options mind
you).  Default ODBC support is provided with the base distribution of
Python, but I would encourage downloading Sam Rushing's DynWin
package.  Just add - "from dynwin import odbc" to the beginning of
your own DB module, and you will have access to a pretty extensive
odbc api.

If you use stored procs extensively, you still can use from within
Python without too much trouble WHERE the SP returns a result set. 
Where you are returning a single value, that's a different story that
I haven't found a workaround to in Python - perhaps others can
comment.

Another alternative is using ADO.  Mark Hammond's win32com package for
python is very nice and makes using ADO about as easy as it gets.  Its
slower than ODBC but its still very easy to use.  If you want to do a
lot of Win32api programming in Python, definitely check out Mark's
Book Pythn Programming on Win32 - lots of great ideas and solid
examples to work from including database stuff.  There are also
examples of using ADO with Python, do a google on it and you find
tutorials out there.  Same for odbc.

Good luck.



More information about the Python-list mailing list