From: Christopher Jones Date: Mon, 11 Nov 2024 21:18:29 +0000 (+1100) Subject: Merge branch 'main' into oracledoc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94839288a4ed4981b98e9f98b391b947886d2d25;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Merge branch 'main' into oracledoc * main: Fix source comment/doc typos (#12072) Improve Oracle identifier length detection --- 94839288a4ed4981b98e9f98b391b947886d2d25 diff --cc lib/sqlalchemy/dialects/oracle/base.py index e5e26e13dc,3985308749..9aa73a78d2 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@@ -173,29 -176,32 +173,29 @@@ should be used on the SQLAlchemy side Max Identifier Lengths ---------------------- -Oracle has changed the default max identifier length as of Oracle Server -version 12.2. Prior to this version, the length was 30, and for 12.2 and -greater it is now 128. This change impacts SQLAlchemy in the area of -generated SQL label names as well as the generation of constraint names, -particularly in the case where the constraint naming convention feature -described at :ref:`constraint_naming_conventions` is being used. - -To assist with this change and others, Oracle includes the concept of a -"compatibility" version, which is a version number that is independent of the -actual server version in order to assist with migration of Oracle databases, -and may be configured within the Oracle server itself. This compatibility -version is retrieved using the query ``SELECT value FROM v$parameter WHERE -name = 'compatible';``. -The SQLAlchemy Oracle dialect, when tasked with determining the default max -identifier length, will use the ``max_identifier_length`` attribute available -in the connection of the oracledb driver since version 2.5. When using an older -version or cx_oracle SQLAlchemy will instead attempted to use the query -mentioned above upon first connect in order to determine the effective -compatibility version of the server, which determines what the maximum allowed -identifier length is for the server. If the table is not available, the server +Oracle Database changed the default max identifier length as of Oracle Database +12.2. Prior to this version, the length was 30, and for 12.2 and greater it is +now 128. This change impacts SQLAlchemy in the area of generated SQL label +names as well as the generation of constraint names, particularly in the case +where the constraint naming convention feature described at +:ref:`constraint_naming_conventions` is being used. + - To assist with this change and others, Oracle Database includes the concept of - a "compatibility" version, which is a version number that is independent of the - actual server version in order to assist with migration of databases, and may - be configured within the Oracle Database server itself. This compatibility - version is retrieved using the query ``SELECT value FROM v$parameter WHERE name - = 'compatible';``. The SQLAlchemy Oracle dialects, when tasked with - determining the default max identifier length, will attempt to use this query - upon first connect in order to determine the effective compatibility version of - the server, which determines what the maximum allowed identifier length is for - the server. If the table is not available, the server version information is - used instead. ++The SQLAlchemy oracledb dialect will use the ``max_identifier_length`` ++attribute available on driver connections since python-oracledb version 2.5. ++When using an older version, or using the cx_Oracle dialect, SQLAlchemy will ++instead attempt to use the query ``SELECT value FROM v$parameter WHERE name = ++'compatible'`` upon first connect in order to determine the effective ++compatibility version of the server. The "compatibility" version is a version ++number that is independent of the actual database version. It is used to assist ++database migration. It is configured by an Oracle Database initialization ++parameter. The compatibility version then determines the maximum allowed ++identifier length for the server. If the V$ view is not available, the database + version information is used instead. -As of SQLAlchemy 1.4, the default max identifier length for the Oracle dialect -is 128 characters. Upon first connect, the compatibility version is detected -and if it is less than Oracle version 12.2, the max identifier length is -changed to be 30 characters. In all cases, setting the +As of SQLAlchemy 1.4, the default max identifier length for the Oracle dialects +is 128 characters. Upon first connection, the compatibility version is +detected and if it is less than Oracle Database version 12.2, the max +identifier length is changed to be 30 characters. In all cases, setting the :paramref:`_sa.create_engine.max_identifier_length` parameter will bypass this change and the value given will be used as is::