summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/build/changelog/migration_20.rst43
-rw-r--r--doc/build/changelog/unreleased_20/5465.rst38
-rw-r--r--doc/build/conf.py1
-rw-r--r--doc/build/core/type_basics.rst6
-rw-r--r--doc/build/dialects/oracle.rst7
5 files changed, 89 insertions, 6 deletions
diff --git a/doc/build/changelog/migration_20.rst b/doc/build/changelog/migration_20.rst
index 380651a30..b8415d61a 100644
--- a/doc/build/changelog/migration_20.rst
+++ b/doc/build/changelog/migration_20.rst
@@ -340,6 +340,49 @@ customizable via the :paramref:`_sa.create_engine.poolclass` parameter.
:ticket:`7490`
+.. _change_5465_oracle:
+
+New Oracle FLOAT type with binary precision; decimal precision not accepted directly
+------------------------------------------------------------------------------------
+
+A new datatype :class:`_oracle.FLOAT` has been added to the Oracle dialect, to
+accompany the addition of :class:`_sqltypes.Double` and database-specific
+:class:`_sqltypes.DOUBLE`, :class:`_sqltypes.DOUBLE_PRECISION` and
+:class:`_sqltypes.REAL` datatypes. Oracle's ``FLOAT`` accepts a so-called
+"binary precision" parameter that per Oracle documentation is roughly a
+standard "precision" value divided by 0.3103::
+
+ from sqlalchemy.dialects import oracle
+
+ Table(
+ "some_table", metadata,
+ Column("value", oracle.FLOAT(126))
+ )
+
+A binary precision value of 126 is synonymous with using the
+:class:`_sqltypes.DOUBLE_PRECISION` datatype, and a value of 63 is equivalent
+to using the :class:`_sqltypes.REAL` datatype. Other precision values are
+specific to the :class:`_oracle.FLOAT` type itself.
+
+The SQLAlchemy :class:`_sqltypes.Float` datatype also accepts a "precision"
+parameter, but this is decimal precision which is not accepted by
+Oracle. Rather than attempting to guess the conversion, the Oracle dialect
+will now raise an informative error if :class:`_sqltypes.Float` is used with
+a precision value against the Oracle backend. To specify a
+:class:`_sqltypes.Float` datatype with an explicit precision value for
+supporting backends, while also supporting other backends, use
+the :meth:`_types.TypeEngine.with_variant` method as follows::
+
+ from sqlalchemy.types import Float
+ from sqlalchemy.dialects import oracle
+
+ Table(
+ "some_table", metadata,
+ Column("value", Float(5).with_variant(oracle.FLOAT(16), "oracle"))
+ )
+
+
+
.. _migration_20_overview:
1.x -> 2.x Migration Overview
diff --git a/doc/build/changelog/unreleased_20/5465.rst b/doc/build/changelog/unreleased_20/5465.rst
new file mode 100644
index 000000000..2bf9f01a9
--- /dev/null
+++ b/doc/build/changelog/unreleased_20/5465.rst
@@ -0,0 +1,38 @@
+.. change::
+ :tags: feature, types
+ :tickets: 5465
+
+ Added :class:`.Double`, :class:`.DOUBLE`, :class:`.DOUBLE_PRECISION`
+ datatypes to the base ``sqlalchemy.`` module namespace, for explicit use of
+ double/double precision as well as generic "double" datatypes. Use
+ :class:`.Double` for generic support that will resolve to DOUBLE/DOUBLE
+ PRECISION/FLOAT as needed for different backends.
+
+
+.. change::
+ :tags: feature, oracle
+ :tickets: 5465
+
+ Implemented DDL and reflection support for ``FLOAT`` datatypes which
+ include an explicit "binary_precision" value. Using the Oracle-specific
+ :class:`_oracle.FLOAT` datatype, the new parameter
+ :paramref:`_oracle.FLOAT.binary_precision` may be specified which will
+ render Oracle's precision for floating point types directly. This value is
+ interpreted during reflection. Upon reflecting back a ``FLOAT`` datatype,
+ the datatype returned is one of :class:`_types.DOUBLE_PRECISION` for a
+ ``FLOAT`` for a precision of 126 (this is also Oracle's default precision
+ for ``FLOAT``), :class:`_types.REAL` for a precision of 63, and
+ :class:`_oracle.FLOAT` for a custom precision, as per Oracle documentation.
+
+ As part of this change, the generic :paramref:`_sqltypes.Float.precision`
+ value is explicitly rejected when generating DDL for Oracle, as this
+ precision cannot be accurately converted to "binary precision"; instead, an
+ error message encourages the use of
+ :meth:`_sqltypes.TypeEngine.with_variant` so that Oracle's specific form of
+ precision may be chosen exactly. This is a backwards-incompatible change in
+ behavior, as the previous "precision" value was silently ignored for
+ Oracle.
+
+ .. seealso::
+
+ :ref:`change_5465_oracle` \ No newline at end of file
diff --git a/doc/build/conf.py b/doc/build/conf.py
index 2284db58e..d5b0a8b11 100644
--- a/doc/build/conf.py
+++ b/doc/build/conf.py
@@ -148,6 +148,7 @@ zzzeeksphinx_module_prefixes = {
"_row": "sqlalchemy.engine",
"_schema": "sqlalchemy.schema",
"_types": "sqlalchemy.types",
+ "_sqltypes": "sqlalchemy.types",
"_asyncio": "sqlalchemy.ext.asyncio",
"_expression": "sqlalchemy.sql.expression",
"_sql": "sqlalchemy.sql.expression",
diff --git a/doc/build/core/type_basics.rst b/doc/build/core/type_basics.rst
index 3ec50cc00..c5c57db32 100644
--- a/doc/build/core/type_basics.rst
+++ b/doc/build/core/type_basics.rst
@@ -52,6 +52,9 @@ type is emitted in ``CREATE TABLE``, such as ``VARCHAR`` see
.. autoclass:: Enum
:members: __init__, create, drop
+.. autoclass:: Double
+ :members:
+
.. autoclass:: Float
:members:
@@ -137,6 +140,9 @@ its exact name in DDL with ``CREATE TABLE`` is issued.
.. autoclass:: DECIMAL
+.. autoclass:: DOUBLE
+
+.. autoclass:: DOUBLE_PRECISION
.. autoclass:: FLOAT
diff --git a/doc/build/dialects/oracle.rst b/doc/build/dialects/oracle.rst
index 988a698e8..bf25ea7ad 100644
--- a/doc/build/dialects/oracle.rst
+++ b/doc/build/dialects/oracle.rst
@@ -32,26 +32,21 @@ construction arguments, are as follows:
.. autoclass:: DATE
:members: __init__
-.. autoclass:: DOUBLE_PRECISION
+.. autoclass:: FLOAT
:members: __init__
-
.. autoclass:: INTERVAL
:members: __init__
-
.. autoclass:: NCLOB
:members: __init__
-
.. autoclass:: NUMBER
:members: __init__
-
.. autoclass:: LONG
:members: __init__
-
.. autoclass:: RAW
:members: __init__