Python and DB support (was: Re: Is Python Dead?)

Steve Holden sholden at holdenweb.com
Tue Jul 3 09:52:24 EDT 2001


You should investigate the dbtuple library. It allows you to simply describe
the record sets returned by DB API compliantr modules so you can either:

a) Refer to fields as attributes of the db tuple, or

b) treat the db tuple as a dictionary and select fields a la ASP/ADO.

If your colleagues think VBScript database access is easy they are clearly
not pushing SQL to anywhere near its limits. Ask them how they would to the
equivalent of the DB API's

cursor.execute("SELECT f1, f2, f3 FROM table WHERE f4=? AND f5=?", (f4val,
f5val))

I think you'll find it's more than a little tricky. Also, in VBScript, if rs
is a recordset (with an implied current member), you have to access fields
using

    rs("FieldName")

This is a bizarre way to reference things by name. If your colleagues see
this as natural then they have their Microsoft blinkers on. I have no
objection to them preferring ASP/ADO, and there are some nice tools
available which let you do some nifty things without having to hack too much
source (as long as you can ignore the resulting code bloat).

But Python is pretty good when it comes to databases, even without touching
ADO.

regards
 Steve

--
http://www.holdenweb.com/




--
http://www.holdenweb.com/


"Roman Suzi" <rnd at onego.ru> wrote in message
news:mailman.994135925.11224.python-list at python.org...
> On 2 Jul 2001, David Bolen wrote:
>
> >Roman Suzi <rnd at onego.ru> writes:
> >
> >> However, my collegues were not satisfied with it. One somplain was that
in
> >> ASP/IIS it is "very easy" to receive a "recordset" from database and
then
> >> apply it in different situations in the ASP-page, because recordset is
an
> >> object and even subqueries could be made without quering DB again.
> >
> >Just curious, but did your colleagues try using Python's COM interface
> >to ADO to retrieve an actual recordset object that they could
> >manipulate the same in Python as in other ASP languages?
>
> Aha! Now I could understand what is the brake of Python library
> development. Most of Python users are Windows users. And they
> have COM for whatever is in their system.
>
> >At least under Windows, it would seem that having solid ODBC and COM
> >support should pretty much cover in Python anything you'd do elsewhere.
> >
> >On other environments, direct support for a particular database is
> >likely to be more desirable, as it's more typical in those
> >environments, but as you've noted, there's a plethora of support
> >modules for various databases - some at various levels.
>
> We mostly have Linux servers, so COM+ADO is no option. The point was not
> to choose between Windows and Linux, ASP was choosen to serve particular
> purpose, for the database already implemented in Microsoft land.
>
> >--
> >-- David
>
> Sincerely yours, Roman Suzi
> --
> _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
> _/ Tuesday, July 03, 2001 _/ Powered by Linux RedHat 6.2 _/
> _/ "Paranoia is nothing to be afraid of!!" _/
>
>





More information about the Python-list mailing list