vernondcole at gmail.com
Mon Jun 20 05:44:13 CEST 2011
May I humbly suggest http://sourceforge.net/projects/adodbapi
It is a fully PEP 249 complaint module, and it specifically supports
IronPython in addition to CPython 2.n or 3.n.
Since ADO runs in ODBC mode by default, you can basically feed it the same
connection string you would normally use for pyodbc -- use stored DSN's,
third-party odbc drivers, and the like. I normally test it using the odbc
drivers for MySQL and PostgreSQL.
If there is a "provider=" token in the connection string, then it switches
over to ADO mode. I use that when testing Microsoft SQL Server and ACCESS
Many of the api extensions found in pyodbc are also present in adodbapi.
Such as "Cursors are iterable" and "Cursor.execute returns the cursor".
Some are slightly different:
> "Access Values By Name
> The DB API specifies that results must be tuple-like, so columns are
normally accessed by indexing into the sequence (e.g. row0) and pyodbc
supports this. However, columns can also be accessed by name:
> cursor.execute("select album_id, photo_id from photos where user_id=1")
> row = cursor.fetchone()
> print row.album_id, row.photo_id
> print row, row # same as above, but less readable"
adodbapi does that too, and also allows:
print row['album_id'], row['photo_id']
While pyodbc allows the programmer to specify that column names may be
forced to lowercase, adodbapi simply ignores case in column names. so:
assert row.album_id == row['Album_ID'] # will pass in adodbapi
You cannot write to an adodbapi row object, but you can specify a
user-written function to convert column values while you read them, which is
what the pyodbc example is used for.
Are there any other pyodbc features you were specifically attracted to?
(Patches and/or requests are often accepted.)
On Sun, Jun 19, 2011 at 12:46 PM, Paul Grenyer <paul.grenyer at gmail.com>
> Hi All
> I was wanting to use pyodbc with IronPython, but the googling I've
> done has suggested that it's not compatible with IronPyton as it's
> cPython based. Is this still the case?
> Paul Grenyer
> e: paul.grenyer at gmail.com
> b: paulgrenyer.blogspot.com
> t: pjgrenyer
> Ironpython-users mailing list
> Ironpython-users at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users