]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Oracle default arraysize is now set by the driver
authorFederico Caselli <cfederico87@gmail.com>
Fri, 12 Jan 2024 18:17:30 +0000 (19:17 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 17 Jan 2024 21:50:19 +0000 (16:50 -0500)
Changed the default arraysize of the Oracle dialects so that the value set
by the driver is used, that is 100 at the time of writing for both
cx_oracle and oracledb. Previously the value was set to 50 by default.

Fixes: #10877
Change-Id: Ie4c53f42437d3d7dbbad36398d7883472577f367

doc/build/changelog/unreleased_20/10877.rst [new file with mode: 0644]
examples/performance/large_resultsets.py
lib/sqlalchemy/dialects/oracle/cx_oracle.py
lib/sqlalchemy/dialects/oracle/oracledb.py
test/requirements.py

diff --git a/doc/build/changelog/unreleased_20/10877.rst b/doc/build/changelog/unreleased_20/10877.rst
new file mode 100644 (file)
index 0000000..8aaac98
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: oracle
+    :tickets: 10877
+
+    Changed the default arraysize of the Oracle dialects so that the value set
+    by the driver is used, that is 100 at the time of writing for both
+    cx_oracle and oracledb. Previously the value was set to 50 by default.
index 9c0d9fc4e2155cc976a55c50d6bb5671e6c0985d..b93459150e5719f0f353d48286e33d0ac7b75795 100644 (file)
@@ -15,6 +15,7 @@ provide a huge amount of functionality.
 """
 from sqlalchemy import Column
 from sqlalchemy import create_engine
+from sqlalchemy import Identity
 from sqlalchemy import Integer
 from sqlalchemy import String
 from sqlalchemy.ext.declarative import declarative_base
@@ -29,7 +30,7 @@ engine = None
 
 class Customer(Base):
     __tablename__ = "customer"
-    id = Column(Integer, primary_key=True)
+    id = Column(Integer, Identity(), primary_key=True)
     name = Column(String(255))
     description = Column(String(255))
 
index e8ed3ab5cb2c23da340d60fac1a1c8d7d087ea3d..69ee82bd2345027506a5e13f72ceb1569d1a4fe8 100644 (file)
@@ -126,10 +126,15 @@ itself.  These options are always passed directly to :func:`_sa.create_engine`
 
 The parameters accepted by the cx_oracle dialect are as follows:
 
-* ``arraysize`` - set the cx_oracle.arraysize value on cursors, defaulted
-  to 50.  This setting is significant with cx_Oracle as the contents of LOB
-  objects are only readable within a "live" row (e.g. within a batch of
-  50 rows).
+* ``arraysize`` - set the cx_oracle.arraysize value on cursors; defaults
+  to ``None``, indicating that the driver default should be used (typically
+  the value is 100).  This setting controls how many rows are buffered when
+  fetching rows, and can have a significant effect on performance when
+  modified.   The setting is used for both ``cx_Oracle`` as well as
+  ``oracledb``.
+
+  .. versionchanged:: 2.0.26 - changed the default value from 50 to None,
+    to use the default value of the driver itself.
 
 * ``auto_convert_lobs`` - defaults to True; See :ref:`cx_oracle_lob`.
 
@@ -1033,7 +1038,7 @@ class OracleDialect_cx_oracle(OracleDialect):
         self,
         auto_convert_lobs=True,
         coerce_to_decimal=True,
-        arraysize=50,
+        arraysize=None,
         encoding_errors=None,
         threaded=None,
         **kwargs,
index 78deecf4a24b5bb8d8332855b3d3c510ed702c80..de5be44d90477a6cce36091e462f5cb79d1a4063 100644 (file)
@@ -101,7 +101,7 @@ class OracleDialect_oracledb(_OracleDialect_cx_oracle):
         self,
         auto_convert_lobs=True,
         coerce_to_decimal=True,
-        arraysize=50,
+        arraysize=None,
         encoding_errors=None,
         thick_mode=None,
         **kwargs,
index 1626c825f24020dc9ba2d360f3ca6b41ec31f971..cb6ceeb2652bb72152221f6bffcd6c49469d2196 100644 (file)
@@ -784,7 +784,7 @@ class DefaultRequirements(SuiteRequirements):
         #8221.
 
         """
-        return fails_if(["mssql", "oracle>=12"])
+        return fails_if(["mssql", "oracle < 23"])
 
     @property
     def parens_in_union_contained_select_w_limit_offset(self):