[PyGreSQL] Version 3.0 PyGreSQL
Tony Lownds
tony at printra.net
Mon Apr 17 10:37:41 EDT 2000
There's a few problems I have found with the functionality of pgdb:
The cursor object does not have arraysize, rowcount or description
attributes. The code sets these values in a private dictionary
instead of directly setting attibutes. Perhaps this private
dictionary was going to be used in __getitem__ and __setitem__
methods. I think it would be fine to just set self.arraysize and the
other attributes directly.
The other problem is with the description attribute - it does not
provide the names of the columns that a query generates, it provides
the type name twice.
The last problem, and I'm not sure about it, is that I am getting
None for values of columns that are empty strings in the database.
The psql utility doesn't show NULLs so its hard to demonstrate now
but the previous version of PyGreSQL returns '' in those columns and
that's how it was inserted. I don't think this problem originates in
pgdb.py. I am using Postgres 6.4.2 btw.
I'd be happy to keep testing as much as circumstances allow, or fix
the first two problems...
Also, there is no Makefile in the -beta.tgz tarball, and the .spec
file has the wrong value in the release macro.
-Tony
p.s. The version I was testing is:
[tony at www tony]$ ls -ld PyGreSQ*
drwxr-x--- 3 tony tony 1024 Apr 17 09:11 PyGreSQL-3.0-pre000409
-rw-rw-r-- 1 tony tony 41840 Apr 9 04:11 PyGreSQL-beta.tgz
p.p.s. Here is an example to show the private dictionary of attibutes:
[tony at www PyGreSQL-3.0-pre000409]$ python
Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66
19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import crypt
>>> import pgdb
>>> conn = pgdb.connect(':test_db')
>>> csr = conn.cursor()
>>> csr.execute('select * from orders')
>>> csr.rowcount
Traceback (innermost last):
File "<stdin>", line 1, in ?
AttributeError: rowcount
>>> csr._pgdbCursor__internal_attr
{'arraysize': 5, 'description': [('varchar', 'varchar', -1, -1, None,
None, None), ('varchar', 'varchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('int4', 'int4', 10, 4, None,
None, None), ('varchar', 'varchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('varchar', 'varchar', -1, -1,
None, None, None), ('varchar', 'varchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('varchar', 'varchar', -1, -1,
None, None, None), ('varchar', 'varchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('varchar', 'varchar', -1, -1,
None, None, None), ('varchar', 'varchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('varchar', 'varchar', -1, -1,
None, None, None), ('varchar', 'varchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('varchar', 'varchar', -1, -1,
None, None, None), ('bpchar', 'bpchar', -1, -1, None, None, None),
('varchar', 'varchar', -1, -1, None, None, None), ('varchar',
'varchar', -1, -1, None, None, None), ('varchar', 'varchar', -1, -1,
None, None, None)], 'rowcount': 785}
More information about the PyGreSQL
mailing list