mapper's usage of fetchall() wont work with oracle binary cols
the new support for binary types in oracle, however limited, means that fetchall() cannot be used with those result sets. the Mapper will have to check a flag on the dialect (or do it in ResultProxy) indicating that fetchall() will either have to "fully" fetch the data (perhaps RowProxy could get a flag "prefetch", checks the values in the typemap for "requires_prefetch()" and does it, possibly), or that fetchall() should not be used.
Comments (7)
-
reporter -
Account Deleted - attached sqlalchemy_435.diff
Patch for PrefetchingResultProxy
-
Account Deleted - attached sqlalchemy_435h_r2300.diff
Patch for PrefetchingResultProxy from revision 2300
-
Account Deleted I've submitted a patch for this bug. fetchall() still doesn't work for result sets returned from Connection.execute_text, since convert_result_value() doesn't do anything in that case.
-
reporter ian -
this patch looks excellent ! i dont think you could have done it any closer to what i was thinking. I will try to have this committed later today.
-
reporter ive committed the patch in changeset:2303 but havent tested on an oracle DB yet; i also want to modify the test in test/sql/testtypes.py to test fetchall().
-
reporter - changed status to resolved
OK ive tested and made another slight change in changeset:2326 since my cx_Oracle version didnt have
BFILE
, and fixed the unit test. - Log in to comment
id like to implement this using a new subclass of
ResultProxy
calledPrefetchingResultProxy
. theConnection
object will query the dialect/executioncontext for arguments to be sent to the ResultProxy (this will require a new method onDialect
and/orExecutionContext
). ResultProxy will use an altered__new__()
method or metaclass to receive the "should_prefetch" argument and then return PrefetchingResultProxy instead if the flag is True.The Oracle dialect should examine the typemap of the result set to be returned, determine if it contains LOBs, and if so then set the flag to true.
The
PrefetchingResultProxy
should load all columns into memory each timefetchone()
is called. iffetchmany()
orfetchall()
are called, the full grid of results should be fetched.the object also may gain some additional flags for usage with Postgres server side cursors, where the
cursor.metadata
is not available untilfetchone()
is called.