Hello,
Based on http://www.sqlalchemy.org/trac/ticket/435 and a perusal of
the source it seems to me that the sqlalchemy fetchall method with
cx_Oracle supports retrieving multiple rows of an Oracle table that
has CLOBs or BLOBs. I am having troubles though. I am either wrong
about sqlalchemy having that feature, I am using it incorrectly or
there is perhaps a bug.
Here is a sql script to create a test table and populate the test
table:
drop table test;
create table test (a_clob clob);
insert into test (a_clob) values ('This is a test');
insert into test (a_clob) values ('This is another test');
commit;
Here is a test script that throws an error when retrieving the rows of
CLOBs with a fetchall:
#!/usr/bin/python
from sqlalchemy import create_engine
import cx_Oracle
db = create_engine("oracle://user:[EMAIL PROTECTED]");
conn = db.connect()
proxy = conn.execute("select a_clob from test");
rows = proxy.fetchall()
for i in rows:
for j in i.values():
print j
Output of script:
$ ./clob.py
Traceback (most recent call last):
File "./clob.py", line 13, in ?
print j
cx_Oracle.ProgrammingError: LOB variable no longer valid after
subsequent fetch
The fetchone() method works fine as expected, since the LOB is being
accessed directly and immediately, for example:
#!/usr/bin/python
from sqlalchemy import create_engine
import cx_Oracle
db = create_engine("oracle://user:[EMAIL PROTECTED]");
conn = db.connect()
proxy = conn.execute("select a_clob from test");
i = proxy.fetchone()
while i != None:
for j in i.values():
print j
i = proxy.fetchone()
Output of run:
$ ./clob_fetchone.py
This is a test
This is another test
I have sqlalchemy-0.3.8 installed with cx_Oracle-4.3.1. The Oracle
database is 10.2 and the Oracle client installation is 10.2 as well.
I'm using python-2.4.3.
Thanks for any help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---