[DB-SIG] Porting a Postgres Python library to Ingres?

Hamish Lawson hbl@st-andrews.ac.uk
Thu, 28 Mar 2002 16:08:48 +0000


Hello Holger!

Firstly, thanks for making your ingmod module available, which I have
been using for some time now.

> I think, my code (ingmod.ec) can easily be converted into thread safe code 
> I'll hope to have the new [thread safe] version out end of April.

That is good news! I look forward to it.

> I'll let You know by email.

Thank you.

> > I think it may need some development in other areas.
> 
> Which other areas You are refering to?  Maybe I'm working on it?  Due
> to heavy workload (book project) I didn't published a new version but
> there were several bug fixes, enhancements ... in the last year.

I wasn't sure if you were still developing ingmod, which is why I was
looking at other options. There were a couple of issues I had found.

The MAXCURSPERSESSION limit appears to be a limit on how many cursors
can get allocated, not just a limit on how many can be open at the same
time; that is, successively allocating and then closing a cursor will
cause the limit to be exceed after MAXCURSPERSESSION times. See listing
1 below.

Under Python 2.2 (including 2.2.1c2), attempting to iterate through
cursor.description sometimes causes a "tuple index out of range" error.
One such occasion is running the ingtest.py script that comes with
ingmod; see listing 2 below. Might this be related to the new iterator
protocol introduced in Python 2.2?

> AFAIK, even UCB Ingres and UCB Postgres didn't share any piece of code.

I thought it possible that they might not share much actual code, but do
you also think that the application programming interface is different
too?

Regards,
Hamish


---------
LISTING 1
--------- 
>>> import ingmod
>>> conn = ingmod.connect('iidbdb')
>>> for i in range(20):
...     cursor = conn.cursor()
...     cursor.execute("select * from ingres_access_requests")
...     cursor.close()
...     print i
...
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
ingmod.OperationalError: max # of cursors per session reached

---------
LISTING 2
--------- 
...
('attver_dropped', <type 'int'>, None, 2, None, None, 0)
('attval_from', <type 'int'>, None, 2, None, None, 0)
('attfree', <type 'str'>, None, 24, None, None, 0)
Traceback (most recent call last):
  File "ingtest.py", line 86, in ?
    for t in cu.description:
IndexError: tuple index out of range