From: Christopher Jones Date: Tue, 12 Nov 2024 21:45:40 +0000 (+1100) Subject: A few more Oracle to Oracle Database conversions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=240398dae3eb769626020266ab1aad2926778215;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git A few more Oracle to Oracle Database conversions --- diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index bb5dde9ce8..ae3f765352 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -724,16 +724,16 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler): # https://www.oracletutorial.com/oracle-basics/oracle-float/ estimated_binary_precision = int(precision / 0.30103) raise exc.ArgumentError( - "Oracle FLOAT types use 'binary precision', which does " - "not convert cleanly from decimal 'precision'. Please " - "specify " - f"this type with a separate Oracle variant, such as " - f"{type_.__class__.__name__}(precision={precision})." + "Oracle Database FLOAT types use 'binary precision', " + "which does not convert cleanly from decimal " + "'precision'. Please specify " + "this type with a separate Oracle Database variant, such " + f"as {type_.__class__.__name__}(precision={precision})." f"with_variant(oracle.FLOAT" f"(binary_precision=" f"{estimated_binary_precision}), 'oracle'), so that the " - "Oracle specific 'binary_precision' may be specified " - "accurately." + "Oracle Database specific 'binary_precision' may be " + "specified accurately." ) else: precision = binary_precision @@ -1495,8 +1495,8 @@ class OracleDialect(default.DefaultDialect): @util.deprecated_params( use_binds_for_limits=( "1.4", - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated. The dialect now renders LIMIT /OFFSET integers " + "The ``use_binds_for_limits`` Oracle Database dialect parameter is " + "deprecated. The dialect now renders LIMIT / OFFSET integers " "inline in all cases using a post-compilation hook, so that the " "value is still represented by a 'bound parameter' on the Core " "Expression side.", diff --git a/test/dialect/oracle/test_compiler.py b/test/dialect/oracle/test_compiler.py index ea7012c06d..02fc443e76 100644 --- a/test/dialect/oracle/test_compiler.py +++ b/test/dialect/oracle/test_compiler.py @@ -811,8 +811,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): def test_use_binds_for_limits_disabled_one_legacy(self): t = table("sometable", column("col1"), column("col2")) with testing.expect_deprecated( - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated." + "The ``use_binds_for_limits`` Oracle Database dialect parameter " + "is deprecated." ): dialect = oracle.OracleDialect( use_binds_for_limits=False, enable_offset_fetch=False @@ -830,8 +830,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): def test_use_binds_for_limits_disabled_two_legacy(self): t = table("sometable", column("col1"), column("col2")) with testing.expect_deprecated( - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated." + "The ``use_binds_for_limits`` Oracle Database dialect parameter " + "is deprecated." ): dialect = oracle.OracleDialect( use_binds_for_limits=False, enable_offset_fetch=False @@ -850,8 +850,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): def test_use_binds_for_limits_disabled_three_legacy(self): t = table("sometable", column("col1"), column("col2")) with testing.expect_deprecated( - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated." + "The ``use_binds_for_limits`` Oracle Database dialect parameter " + "is deprecated." ): dialect = oracle.OracleDialect( use_binds_for_limits=False, enable_offset_fetch=False @@ -872,8 +872,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): def test_use_binds_for_limits_enabled_one_legacy(self): t = table("sometable", column("col1"), column("col2")) with testing.expect_deprecated( - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated." + "The ``use_binds_for_limits`` Oracle Database dialect parameter " + "is deprecated." ): dialect = oracle.OracleDialect( use_binds_for_limits=True, enable_offset_fetch=False @@ -891,8 +891,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): def test_use_binds_for_limits_enabled_two_legacy(self): t = table("sometable", column("col1"), column("col2")) with testing.expect_deprecated( - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated." + "The ``use_binds_for_limits`` Oracle Database dialect parameter " + "is deprecated." ): dialect = oracle.OracleDialect( use_binds_for_limits=True, enable_offset_fetch=False @@ -912,8 +912,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): def test_use_binds_for_limits_enabled_three_legacy(self): t = table("sometable", column("col1"), column("col2")) with testing.expect_deprecated( - "The ``use_binds_for_limits`` Oracle dialect parameter is " - "deprecated." + "The ``use_binds_for_limits`` Oracle Database dialect parameter " + "is deprecated." ): dialect = oracle.OracleDialect( use_binds_for_limits=True, enable_offset_fetch=False diff --git a/test/dialect/oracle/test_types.py b/test/dialect/oracle/test_types.py index b8396df4fa..2c9d1c2134 100644 --- a/test/dialect/oracle/test_types.py +++ b/test/dialect/oracle/test_types.py @@ -375,12 +375,13 @@ class TypesTest(fixtures.TestBase): def test_no_decimal_float_precision(self): with expect_raises_message( exc.ArgumentError, - "Oracle FLOAT types use 'binary precision', which does not " - "convert cleanly from decimal 'precision'. Please specify this " - "type with a separate Oracle variant, such as " + "Oracle Database FLOAT types use 'binary precision', which does " + "not convert cleanly from decimal 'precision'. Please specify " + "this type with a separate Oracle Database variant, such as " r"FLOAT\(precision=5\).with_variant\(oracle.FLOAT\(" r"binary_precision=16\), 'oracle'\), so that the Oracle " - "specific 'binary_precision' may be specified accurately.", + "Database specific 'binary_precision' may be specified " + "accurately.", ): FLOAT(5).compile(dialect=oracle.dialect()) @@ -571,7 +572,7 @@ class TypesTest(fixtures.TestBase): ) def test_numerics_broken_inspection(self, metadata, connection): - """Numeric scenarios where Oracle type info is 'broken', + """Numeric scenarios where Oracle Databasee type info is 'broken', returning us precision, scale of the form (0, 0) or (0, -127). We convert to Decimal and let int()/float() processors take over.