Reputation: 792
Based on the sqlalchemy docs I should be able to set arraysize on cxOracle. however setting it as a create_engine arg doesn't work: http://docs.sqlalchemy.org/en/rel_0_9/dialects/oracle.html#dialect-oracle-cx_oracle-connect
import sqlalchemy
url = sqlalchemy.engine.url.make_url(r'oracle+cx_oracle://user:pass@host:port/dbname') # replaced with appropriate db connection
engine = sqlalchemy.create_engine(url, arraysize=50000)
cursor = engine.raw_connection().cursor()
print cursor.arraysize
#still only 50
even setting it in the connection string also doesn't work:
import sqlalchemy
url = sqlalchemy.engine.url.make_url(r'r'oracle+cx_oracle://user:pass@host:port/dbname?arraysize=5000')
engine = sqlalchemy.create_engine(url)
cursor = engine.raw_connection().cursor()
print cursor.arraysize
am I doing something stupid? or can someone post a snippet that successfully sets the arraysize at the engine level.
Upvotes: 0
Views: 1941
Reputation: 318
I think the issue here is that you're making a end-run around the normal mechanism by which SQLAlchemy would get and configure the cursor for its own use. By using raw_connection
you're getting the cursor from the underlying DB driver (cx_oracle) directly, which defaults to an arraysize
of 50. If you were using some of the "usual" SQLAlchemy objects (e.g. by getting a connection from the engine and calling execute
on it), then you'd be going through the code path at https://github.com/zzzeek/sqlalchemy/blob/rel_0_9_10/lib/sqlalchemy/dialects/oracle/cx_oracle.py#L526 which would indeed set the passed-in arraysize
on the cursor that SQLAlchemy would use.
Upvotes: 0