newbie database question

Joseph A Knapka jknapka at earthlink.net
Tue Jan 8 22:40:46 EST 2002


james kowalka wrote:
> 
> I am brand new to Python, and need to develop some database programs to
> read/write some old DBF file info.  I installed mxODBC, but can't seem to
> figure out how to access a particular field to read or write it's data.  How
> can I access fields directly through a connection cursor (ie, db->fname =
> "Steve", or firstname = db->fname), like in c++ or delphi.

I submitted a recipe to ASPN's Python Cookbook yesterday to do
just this :-). ODBC gives you an interface to send SQL queries
to the server, but it's not difficult to make your object's
attribute access magically fetch from and update to the DB.

The recipe URL is:

<URL: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/106131>

"Rated 3-out-of-5 by 1 user(s)", so I guess there's a lot of
room for improvement :-)

Cheers,

-- Joe
"I should like to close this book by sticking out any part of my neck
 which is not yet exposed, and making a few predictions about how the
 problem of quantum gravity will in the end be solved."
 --- Physicist Lee Smolin, "Three Roads to Quantum Gravity"



More information about the Python-list mailing list