Login Register Actian.com  

Actian Community Wiki

Navigation
Learn About
Developing With
Ingres Talk
Information
Toolbox

Python DBI

From Ingres Community Wiki

Jump to: navigation, search

Contents

Python DBI

Getting the Driver

Source code for all platforms are available from http://code.ingres.com/ingres/drivers/python/main/. Also see [[1]] [[2]]

Dependencies

The python driver is dependent on the Ingres ODBC libraries. You must have a client install including the ODBC component for the python driver to work. Under Unix the Ingres CLI is used so there is no need to install or configure UnixODBC.

Setup

You need to define ODBCSYSINI for the python driver to work, even if you do not plan to define any vnodes. ODBCSYSINI is generally $II_SYSTEM/ingres/files. you can easily specify a vnode dynamically using this syntax:

ingresdbi.connect(database=database, vnode=vnode, uid=username, pwd=password)

and vnode can be "(local)"

alternatively, you can define vnodes with vdba or netutil.

Sample Code

Simple examples:

Testing

IngresDBI ships with a test suite in the "tests" directory. This is a [[3]] based test. This makes use of http://stuartbishop.net/Software/DBAPI20TestSuite/ (note consider checking out http://code.google.com/p/acute-dbapi/ too).

Assuming IngresDBI is installed along with Ingres simply issue:

./test_ingresdbi_dbapi20.py

Or

test_ingresdbi_dbapi20.py

You may need to call Python directory depending on how your machine is configured.

Other options:

test_ingresdbi_dbapi20.py -v
test_ingresdbi_dbapi20.py -q

testing individual tests:

./test_ingresdbi_dbapi20.py  test_Ingresdbi.test_PyNoneTooManyFrees

Results

As of 05-Aug-2009:

(ingpython)ingres@clach04perl:~/clach04/python/main/tests$ ./test_ingresdbi_dbapi20.py -q
./test_ingresdbi_dbapi20.py:77: UserWarning: FIXME Filtering of warnings enabled! This should be checked.
  warnings.warn('FIXME Filtering of warnings enabled! This should be checked.')
----------------------------------------------------------------------
Ran 50 tests in 11.394s

OK

Known Issues and Limitations

Anyone?

Personal tools
© 2011 Actian Corporation. All Rights Reserved