Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/oracle/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/oracle/__pycache__/base.cpython-311.pyc

�

�܋f�1��2�dZddlmZddlZddlmZddlmZddlmZddlm	Z	dd	lm
Zdd
lmZddl
mZddl
mZdd
l	mZddl	mZdd
l	mZddl	mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZed�����Zed�����Z Gd�dej!��Z"e"Z#Gd�dej$��Z%Gd�d e��Z&eZ'Gd!�d"ej(ej)��Z*Gd#�d$ej+��Z,Gd%�d&ej+��Z-Gd'�d(ej+��Z.Gd)�d*ej/��Z0Gd+�d,ej$��Z1Gd-�d.ej2��Z3Gd/�d0ej4��Z5Gd1�d2ej4��Z6Gd3�d4ej7��Z8ej7e8ej9e5ej2e3iZ:id e�d5e�d6e�d7e�d.e3�d"e*�d8e�d*e0�d9e�de%�d:e�d;e�d<e5�de"�d=e�d>e,�d,e1�e-e.d?��Z;Gd@�dAej<��Z=GdB�dCej>��Z?GdD�dEej@��ZAGdF�dGejB��ZCGdH�dIejD��ZEGdJ�dKejF��ZGGdL�dMe	jH��ZIdS)NaPO
.. dialect:: oracle
    :name: Oracle

    Oracle version 8 through current (11g at the time of this writing) are
    supported.


Auto Increment Behavior
-----------------------

SQLAlchemy Table objects which include integer primary keys are usually
assumed to have "autoincrementing" behavior, meaning they can generate their
own primary key values upon INSERT.  Since Oracle has no "autoincrement"
feature, SQLAlchemy relies upon sequences to produce these values.   With the
Oracle dialect, *a sequence must always be explicitly specified to enable
autoincrement*.  This is divergent with the majority of documentation
examples which assume the usage of an autoincrement-capable database.   To
specify sequences, use the sqlalchemy.schema.Sequence object which is passed
to a Column construct::

  t = Table('mytable', metadata,
        Column('id', Integer, Sequence('id_seq'), primary_key=True),
        Column(...), ...
  )

This step is also required when using table reflection, i.e. autoload=True::

  t = Table('mytable', metadata,
        Column('id', Integer, Sequence('id_seq'), primary_key=True),
        autoload=True
  )


.. _oracle_isolation_level:

Transaction Isolation Level / Autocommit
----------------------------------------

The Oracle database supports "READ COMMITTED" and "SERIALIZABLE" modes of
isolation. The AUTOCOMMIT isolation level is also supported by the cx_Oracle
dialect.

To set using per-connection execution options::

    connection = engine.connect()
    connection = connection.execution_options(
        isolation_level="AUTOCOMMIT"
    )

For ``READ COMMITTED`` and ``SERIALIZABLE``, the Oracle dialect sets the
level at the session level using ``ALTER SESSION``, which is reverted back
to its default setting when the connection is returned to the connection
pool.

Valid values for ``isolation_level`` include:

* ``READ COMMITTED``
* ``AUTOCOMMIT``
* ``SERIALIZABLE``

.. note:: The implementation for the
   :meth:`_engine.Connection.get_isolation_level` method as implemented by the
   Oracle dialect necessarily forces the start of a transaction using the
   Oracle LOCAL_TRANSACTION_ID function; otherwise no level is normally
   readable.

   Additionally, the :meth:`_engine.Connection.get_isolation_level` method will
   raise an exception if the ``v$transaction`` view is not available due to
   permissions or other reasons, which is a common occurrence in Oracle
   installations.

   The cx_Oracle dialect attempts to call the
   :meth:`_engine.Connection.get_isolation_level` method when the dialect makes
   its first connection to the database in order to acquire the
   "default"isolation level.  This default level is necessary so that the level
   can be reset on a connection after it has been temporarily modified using
   :meth:`_engine.Connection.execution_options` method.   In the common event
   that the :meth:`_engine.Connection.get_isolation_level` method raises an
   exception due to ``v$transaction`` not being readable as well as any other
   database-related failure, the level is assumed to be "READ COMMITTED".  No
   warning is emitted for this initial first-connect condition as it is
   expected to be a common restriction on Oracle databases.

.. versionadded:: 1.3.16 added support for AUTOCOMMIT to the cx_oracle dialect
   as well as the notion of a default isolation level

.. versionadded:: 1.3.21 Added support for SERIALIZABLE as well as live
   reading of the isolation level.

.. versionchanged:: 1.3.22 In the event that the default isolation
   level cannot be read due to permissions on the v$transaction view as
   is common in Oracle installations, the default isolation level is hardcoded
   to "READ COMMITTED" which was the behavior prior to 1.3.21.

.. seealso::

    :ref:`dbapi_autocommit`

Identifier Casing
-----------------

In Oracle, the data dictionary represents all case insensitive identifier
names using UPPERCASE text.   SQLAlchemy on the other hand considers an
all-lower case identifier name to be case insensitive.   The Oracle dialect
converts all case insensitive identifiers to and from those two formats during
schema level communication, such as reflection of tables and indexes.   Using
an UPPERCASE name on the SQLAlchemy side indicates a case sensitive
identifier, and SQLAlchemy will quote the name - this will cause mismatches
against data dictionary data received from Oracle, so unless identifier names
have been truly created as case sensitive (i.e. using quoted names), all
lowercase names should be used on the SQLAlchemy side.

.. _oracle_max_identifier_lengths:

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 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.

For the duration of the SQLAlchemy 1.3 series, the default max identifier
length will remain at 30, even if compatibility version 12.2 or greater is in
use.  When the newer version is detected, a warning will be emitted upon first
connect, which refers the user to make use of the
:paramref:`_sa.create_engine.max_identifier_length`
parameter in order to assure
forwards compatibility with SQLAlchemy 1.4, which will be changing this value
to 128 when compatibility version 12.2 or greater is detected.

Using :paramref:`_sa.create_engine.max_identifier_length`,
the effective identifier
length used by the SQLAlchemy dialect will be used as given, overriding the
current default value of 30, so that when Oracle 12.2 or greater is used, the
newer identifier length may be taken advantage of::

    engine = create_engine(
        "oracle+cx_oracle://scott:tiger@oracle122",
        max_identifier_length=128)

The maximum identifier length comes into play both when generating anonymized
SQL labels in SELECT statements, but more crucially when generating constraint
names from a naming convention.  It is this area that has created the need for
SQLAlchemy to change this default conservatively.   For example, the following
naming convention produces two very different constraint names based on the
identifier length::

    from sqlalchemy import Column
    from sqlalchemy import Index
    from sqlalchemy import Integer
    from sqlalchemy import MetaData
    from sqlalchemy import Table
    from sqlalchemy.dialects import oracle
    from sqlalchemy.schema import CreateIndex

    m = MetaData(naming_convention={"ix": "ix_%(column_0N_name)s"})

    t = Table(
        "t",
        m,
        Column("some_column_name_1", Integer),
        Column("some_column_name_2", Integer),
        Column("some_column_name_3", Integer),
    )

    ix = Index(
        None,
        t.c.some_column_name_1,
        t.c.some_column_name_2,
        t.c.some_column_name_3,
    )

    oracle_dialect = oracle.dialect(max_identifier_length=30)
    print(CreateIndex(ix).compile(dialect=oracle_dialect))

With an identifier length of 30, the above CREATE INDEX looks like::

    CREATE INDEX ix_some_column_name_1s_70cd ON t
    (some_column_name_1, some_column_name_2, some_column_name_3)

However with length=128, it becomes::

    CREATE INDEX ix_some_column_name_1some_column_name_2some_column_name_3 ON t
    (some_column_name_1, some_column_name_2, some_column_name_3)

The implication here is that by upgrading SQLAlchemy to version 1.4 on
an existing Oracle 12.2 or greater database, the generation of constraint
names will change, which can impact the behavior of database migrations.
A key example is a migration that wishes to "DROP CONSTRAINT" on a name that
was previously generated with the shorter length.  This migration will fail
when the identifier length is changed without the name of the index or
constraint first being adjusted.

Therefore, applications are strongly advised to make use of
:paramref:`_sa.create_engine.max_identifier_length`
in order to maintain control
of the generation of truncated names, and to fully review and test all database
migrations in a staging environment when changing this value to ensure that the
impact of this change has been mitigated.


.. versionadded:: 1.3.9 Added the
   :paramref:`_sa.create_engine.max_identifier_length` parameter; the Oracle
   dialect now detects compatibility version 12.2 or greater and warns
   about upcoming max identitifier length changes in SQLAlchemy 1.4.


LIMIT/OFFSET Support
--------------------

Oracle has no support for the LIMIT or OFFSET keywords.  SQLAlchemy uses
a wrapped subquery approach in conjunction with ROWNUM.  The exact methodology
is taken from
http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html .

There are two options which affect its behavior:

* the "FIRST ROWS()" optimization keyword is not used by default.  To enable
  the usage of this optimization directive, specify ``optimize_limits=True``
  to :func:`_sa.create_engine`.
* the values passed for the limit/offset are sent as bound parameters.   Some
  users have observed that Oracle produces a poor query plan when the values
  are sent as binds and not rendered literally.   To render the limit/offset
  values literally within the SQL statement, specify
  ``use_binds_for_limits=False`` to :func:`_sa.create_engine`.

Some users have reported better performance when the entirely different
approach of a window query is used, i.e. ROW_NUMBER() OVER (ORDER BY), to
provide LIMIT/OFFSET (note that the majority of users don't observe this).
To suit this case the method used for LIMIT/OFFSET can be replaced entirely.
See the recipe at
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/WindowFunctionsByDefault
which installs a select compiler that overrides the generation of limit/offset
with a window function.

.. _oracle_returning:

RETURNING Support
-----------------

The Oracle database supports a limited form of RETURNING, in order to retrieve
result sets of matched rows from INSERT, UPDATE and DELETE statements.
Oracle's RETURNING..INTO syntax only supports one row being returned, as it
relies upon OUT parameters in order to function.  In addition, supported
DBAPIs have further limitations (see :ref:`cx_oracle_returning`).

SQLAlchemy's "implicit returning" feature, which employs RETURNING within an
INSERT and sometimes an UPDATE statement in order to fetch newly generated
primary key values and other SQL defaults and expressions, is normally enabled
on the Oracle backend.  By default, "implicit returning" typically only
fetches the value of a single ``nextval(some_seq)`` expression embedded into
an INSERT in order to increment a sequence within an INSERT statement and get
the value back at the same time. To disable this feature across the board,
specify ``implicit_returning=False`` to :func:`_sa.create_engine`::

    engine = create_engine("oracle://scott:tiger@dsn",
                           implicit_returning=False)

Implicit returning can also be disabled on a table-by-table basis as a table
option::

    # Core Table
    my_table = Table("my_table", metadata, ..., implicit_returning=False)


    # declarative
    class MyClass(Base):
        __tablename__ = 'my_table'
        __table_args__ = {"implicit_returning": False}

.. seealso::

    :ref:`cx_oracle_returning` - additional cx_oracle-specific restrictions on
    implicit returning.

ON UPDATE CASCADE
-----------------

Oracle doesn't have native ON UPDATE CASCADE functionality.  A trigger based
solution is available at
http://asktom.oracle.com/tkyte/update_cascade/index.html .

When using the SQLAlchemy ORM, the ORM has limited ability to manually issue
cascading updates - specify ForeignKey objects using the
"deferrable=True, initially='deferred'" keyword arguments,
and specify "passive_updates=False" on each relationship().

Oracle 8 Compatibility
----------------------

When Oracle 8 is detected, the dialect internally configures itself to the
following behaviors:

* the use_ansi flag is set to False.  This has the effect of converting all
  JOIN phrases into the WHERE clause, and in the case of LEFT OUTER JOIN
  makes use of Oracle's (+) operator.

* the NVARCHAR2 and NCLOB datatypes are no longer generated as DDL when
  the :class:`~sqlalchemy.types.Unicode` is used - VARCHAR2 and CLOB are
  issued instead.   This because these types don't seem to work correctly on
  Oracle 8 even though they are available.  The
  :class:`~sqlalchemy.types.NVARCHAR` and
  :class:`~sqlalchemy.dialects.oracle.NCLOB` types will always generate
  NVARCHAR2 and NCLOB.

* the "native unicode" mode is disabled when using cx_oracle, i.e. SQLAlchemy
  encodes all Python unicode objects to "string" before passing in as bind
  parameters.

Synonym/DBLINK Reflection
-------------------------

When using reflection with Table objects, the dialect can optionally search
for tables indicated by synonyms, either in local or remote schemas or
accessed over DBLINK, by passing the flag ``oracle_resolve_synonyms=True`` as
a keyword argument to the :class:`_schema.Table` construct::

    some_table = Table('some_table', autoload=True,
                                autoload_with=some_engine,
                                oracle_resolve_synonyms=True)

When this flag is set, the given name (such as ``some_table`` above) will
be searched not just in the ``ALL_TABLES`` view, but also within the
``ALL_SYNONYMS`` view to see if this name is actually a synonym to another
name.  If the synonym is located and refers to a DBLINK, the oracle dialect
knows how to locate the table's information using DBLINK syntax(e.g.
``@dblink``).

``oracle_resolve_synonyms`` is accepted wherever reflection arguments are
accepted, including methods such as :meth:`_schema.MetaData.reflect` and
:meth:`_reflection.Inspector.get_columns`.

If synonyms are not in use, this flag should be left disabled.

.. _oracle_constraint_reflection:

Constraint Reflection
---------------------

The Oracle dialect can return information about foreign key, unique, and
CHECK constraints, as well as indexes on tables.

Raw information regarding these constraints can be acquired using
:meth:`_reflection.Inspector.get_foreign_keys`,
:meth:`_reflection.Inspector.get_unique_constraints`,
:meth:`_reflection.Inspector.get_check_constraints`, and
:meth:`_reflection.Inspector.get_indexes`.

.. versionchanged:: 1.2  The Oracle dialect can now reflect UNIQUE and
   CHECK constraints.

When using reflection at the :class:`_schema.Table` level, the
:class:`_schema.Table`
will also include these constraints.

Note the following caveats:

* When using the :meth:`_reflection.Inspector.get_check_constraints` method,
  Oracle
  builds a special "IS NOT NULL" constraint for columns that specify
  "NOT NULL".  This constraint is **not** returned by default; to include
  the "IS NOT NULL" constraints, pass the flag ``include_all=True``::

      from sqlalchemy import create_engine, inspect

      engine = create_engine("oracle+cx_oracle://s:t@dsn")
      inspector = inspect(engine)
      all_check_constraints = inspector.get_check_constraints(
          "some_table", include_all=True)

* in most cases, when reflecting a :class:`_schema.Table`,
  a UNIQUE constraint will
  **not** be available as a :class:`.UniqueConstraint` object, as Oracle
  mirrors unique constraints with a UNIQUE index in most cases (the exception
  seems to be when two or more unique constraints represent the same columns);
  the :class:`_schema.Table` will instead represent these using
  :class:`.Index`
  with the ``unique=True`` flag set.

* Oracle creates an implicit index for the primary key of a table; this index
  is **excluded** from all index results.

* the list of columns reflected for an index will not include column names
  that start with SYS_NC.

Table names with SYSTEM/SYSAUX tablespaces
-------------------------------------------

The :meth:`_reflection.Inspector.get_table_names` and
:meth:`_reflection.Inspector.get_temp_table_names`
methods each return a list of table names for the current engine. These methods
are also part of the reflection which occurs within an operation such as
:meth:`_schema.MetaData.reflect`.  By default,
these operations exclude the ``SYSTEM``
and ``SYSAUX`` tablespaces from the operation.   In order to change this, the
default list of tablespaces excluded can be changed at the engine level using
the ``exclude_tablespaces`` parameter::

    # exclude SYSAUX and SOME_TABLESPACE, but not SYSTEM
    e = create_engine(
      "oracle://scott:tiger@xe",
      exclude_tablespaces=["SYSAUX", "SOME_TABLESPACE"])

.. versionadded:: 1.1

DateTime Compatibility
----------------------

Oracle has no datatype known as ``DATETIME``, it instead has only ``DATE``,
which can actually store a date and time value.  For this reason, the Oracle
dialect provides a type :class:`_oracle.DATE` which is a subclass of
:class:`.DateTime`.   This type has no special behavior, and is only
present as a "marker" for this type; additionally, when a database column
is reflected and the type is reported as ``DATE``, the time-supporting
:class:`_oracle.DATE` type is used.

.. versionchanged:: 0.9.4 Added :class:`_oracle.DATE` to subclass
   :class:`.DateTime`.  This is a change as previous versions
   would reflect a ``DATE`` column as :class:`_types.DATE`, which subclasses
   :class:`.Date`.   The only significance here is for schemes that are
   examining the type of column for use in special Python translations or
   for migrating schemas to other database backends.

.. _oracle_table_options:

Oracle Table Options
-------------------------

The CREATE TABLE phrase supports the following options with Oracle
in conjunction with the :class:`_schema.Table` construct:


* ``ON COMMIT``::

    Table(
        "some_table", metadata, ...,
        prefixes=['GLOBAL TEMPORARY'], oracle_on_commit='PRESERVE ROWS')

.. versionadded:: 1.0.0

* ``COMPRESS``::

    Table('mytable', metadata, Column('data', String(32)),
        oracle_compress=True)

    Table('mytable', metadata, Column('data', String(32)),
        oracle_compress=6)

   The ``oracle_compress`` parameter accepts either an integer compression
   level, or ``True`` to use the default compression level.

.. versionadded:: 1.0.0

.. _oracle_index_options:

Oracle Specific Index Options
-----------------------------

Bitmap Indexes
~~~~~~~~~~~~~~

You can specify the ``oracle_bitmap`` parameter to create a bitmap index
instead of a B-tree index::

    Index('my_index', my_table.c.data, oracle_bitmap=True)

Bitmap indexes cannot be unique and cannot be compressed. SQLAlchemy will not
check for such limitations, only the database will.

.. versionadded:: 1.0.0

Index compression
~~~~~~~~~~~~~~~~~

Oracle has a more efficient storage mode for indexes containing lots of
repeated values. Use the ``oracle_compress`` parameter to turn on key
compression::

    Index('my_index', my_table.c.data, oracle_compress=True)

    Index('my_index', my_table.c.data1, my_table.c.data2, unique=True,
           oracle_compress=1)

The ``oracle_compress`` parameter accepts either an integer specifying the
number of prefix columns to compress, or ``True`` to use the default (all
columns for non-unique indexes, all but the last column for unique indexes).

.. versionadded:: 1.0.0

�)�groupbyN�)�Computed)�exc��schema)�sql)�types)�util)�default)�
reflection)�compiler)�
expression)�visitors)�BLOB)�CHAR)�CLOB)�FLOAT)�INTEGER)�NCHAR)�NVARCHAR)�	TIMESTAMP)�VARCHARa
SHARE RAW DROP BETWEEN FROM DESC OPTION PRIOR LONG THEN DEFAULT ALTER IS INTO MINUS INTEGER NUMBER GRANT IDENTIFIED ALL TO ORDER ON FLOAT DATE HAVING CLUSTER NOWAIT RESOURCE ANY TABLE INDEX FOR UPDATE WHERE CHECK SMALLINT WITH DELETE BY ASC REVOKE LIKE SIZE RENAME NOCOMPRESS NULL GROUP VALUES AS IN VIEW EXCLUSIVE COMPRESS SYNONYM SELECT INSERT EXISTS NOT TRIGGER ELSE CREATE INTERSECT PCTFREE DISTINCT USER CONNECT SET MODE OF UNIQUE VARCHAR2 VARCHAR LOCK OR CHAR DECIMAL UNION PUBLIC AND START UID COMMENT CURRENT LEVELz<UID CURRENT_DATE SYSDATE USER CURRENT_TIME CURRENT_TIMESTAMPc��eZdZdZdS)�RAWN��__name__�
__module__�__qualname__�__visit_name__���r/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/oracle/base.pyrr.s�������N�N�Nr"rc��eZdZdZdS)�NCLOBNrr!r"r#r%r%5��������N�N�Nr"r%c��eZdZdZdS)�VARCHAR2Nrr!r"r#r(r(9s�������N�N�Nr"r(c�D��eZdZdZd�fd�	Z�fd�Zed���Z�xZS)�NUMBERNc���|�t|o|dk��}tt|���|||���dS)Nr)�	precision�scale�	asdecimal)�bool�superr*�__init__)�selfr,r-r.�	__class__s    �r#r1zNUMBER.__init__CsW������U�0�u�q�y�1�1�I�
�f�d���$�$��u�	�	%�	
�	
�	
�	
�	
r"c�f��tt|���|��}d|_|S)NT)r0r*�adapt�_is_oracle_number)r2�impltype�retr3s   �r#r5zNUMBER.adaptKs-����F�D�!�!�'�'��1�1�� $����
r"c�p�t|jo
|jdk��rtjStjS�Nr)r/r-�sqltypes�Numeric�Integer�r2s r#�_type_affinityzNUMBER._type_affinityQs1����
�-�t�z�A�~�.�.�	$��#�#��#�#r"�NNN)	rrrr r1r5�propertyr?�
__classcell__�r3s@r#r*r*@sv��������N�
�
�
�
�
�
�������$�$��X�$�$�$�$�$r"r*c��eZdZdZdS)�DOUBLE_PRECISIONNrr!r"r#rErEYs������'�N�N�Nr"rEc��eZdZdZdS)�
BINARY_DOUBLENrr!r"r#rGrG]s������$�N�N�Nr"rGc��eZdZdZdS)�BINARY_FLOATNrr!r"r#rIrIas������#�N�N�Nr"rIc��eZdZdZdS)�BFILENrr!r"r#rKrKer&r"rKc��eZdZdZdS)�LONGNrr!r"r#rMrMis�������N�N�Nr"rMc��eZdZdZdZd�ZdS)�DATEz�Provide the oracle DATE type.

    This type has no special Python behavior, except that it subclasses
    :class:`_types.DateTime`; this is to suit the fact that the Oracle
    ``DATE`` type supports a time value.

    .. versionadded:: 0.9.4

    c�@�|jtjtjfvS�N)r?r;�DateTime�Date)r2�others  r#�_compare_type_affinityzDATE._compare_type_affinityzs���#��(9�8�=�'I�I�Ir"N)rrr�__doc__r rUr!r"r#rOrOms9���������N�J�J�J�J�Jr"rOc�F�eZdZdZdd�Zed���Zed���ZdS)�INTERVALNc�"�||_||_dS)aConstruct an INTERVAL.

        Note that only DAY TO SECOND intervals are currently supported.
        This is due to a lack of support for YEAR TO MONTH intervals
        within available DBAPIs (cx_oracle and zxjdbc).

        :param day_precision: the day precision value.  this is the number of
          digits to store for the day field.  Defaults to "2"
        :param second_precision: the second precision value.  this is the
          number of digits to store for the fractional seconds field.
          Defaults to "6".

        N��
day_precision�second_precision)r2r[r\s   r#r1zINTERVAL.__init__�s��+��� 0����r"c�8�t|j|j���S)NrZ)rXr[r\)�cls�intervals  r#�_adapt_from_generic_intervalz%INTERVAL._adapt_from_generic_interval�s%���"�0�%�6�
�
�
�	
r"c��tjSrQ)r;�Intervalr>s r#r?zINTERVAL._type_affinity�s��� � r")NN)	rrrr r1�classmethodr`rAr?r!r"r#rXrX~sc�������N�1�1�1�1�"�
�
��[�
��!�!��X�!�!�!r"rXc��eZdZdZdZdS)�ROWIDzPOracle ROWID type.

    When used in a cast() or similar, generates ROWID.

    N)rrrrVr r!r"r#rere�s���������N�N�Nr"rec��eZdZd�ZdS)�_OracleBooleanc��|jSrQ)r*)r2�dbapis  r#�get_dbapi_typez_OracleBoolean.get_dbapi_type�s
���|�r"N)rrrrjr!r"r#rgrg�s#����������r"rg�	NVARCHAR2rrrrr�TIMESTAMP WITH TIME ZONEzINTERVAL DAY TO SECONDr�DOUBLE PRECISION)rGrIc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
	dd�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�OracleTypeCompilerc��|j|fi|��SrQ)�
visit_DATE�r2�type_�kws   r#�visit_datetimez!OracleTypeCompiler.visit_datetime�����t��u�+�+��+�+�+r"c��|j|fi|��SrQ)�visit_FLOATrrs   r#�visit_floatzOracleTypeCompiler.visit_float�s���t���,�,��,�,�,r"c�R�|jjr|j|fi|��S|j|fi|��SrQ)�dialect�_use_nchar_for_unicode�visit_NVARCHAR2�visit_VARCHAR2rrs   r#�
visit_unicodez OracleTypeCompiler.visit_unicode�sE���<�.�	4�'�4�'��4�4��4�4�4�&�4�&�u�3�3��3�3�3r"c�^�d|jdur
d|jzpd�d|jdur
d|jzpd��S)NzINTERVAL DAYz(%d)�z
 TO SECONDrZrrs   r#�visit_INTERVALz!OracleTypeCompiler.visit_INTERVAL�se�����t�+�
-���,�,�
��
�
�
�"�$�.�
0���/�/�
��
�	
�	
r"c��dS)NrMr!rrs   r#�
visit_LONGzOracleTypeCompiler.visit_LONG�����vr"c��|jrdSdS)Nrlr��timezonerrs   r#�visit_TIMESTAMPz"OracleTypeCompiler.visit_TIMESTAMP�s���>�	�-�-��;r"c� �|j|dfi|��S)Nrm��_generate_numericrrs   r#�visit_DOUBLE_PRECISIONz)OracleTypeCompiler.visit_DOUBLE_PRECISION�s ��%�t�%�e�-?�F�F�2�F�F�Fr"c� �|j|dfi|��S)NrGr�rrs   r#�visit_BINARY_DOUBLEz&OracleTypeCompiler.visit_BINARY_DOUBLE�s��%�t�%�e�_�C�C��C�C�Cr"c� �|j|dfi|��S)NrIr�rrs   r#�visit_BINARY_FLOATz%OracleTypeCompiler.visit_BINARY_FLOAT�s��%�t�%�e�^�B�B�r�B�B�Br"c�*�d|d<|j|dfi|��S)NT�no_precisionrr�rrs   r#rxzOracleTypeCompiler.visit_FLOAT�s+��"��>��%�t�%�e�W�;�;��;�;�;r"c� �|j|dfi|��S)Nr*r�rrs   r#�visit_NUMBERzOracleTypeCompiler.visit_NUMBER�s��%�t�%�e�X�<�<��<�<�<r"NFc�t�|�|j}|�t|dd��}|s|�|S|�
d}|||d�zSd}||||d�zS)Nr-z%(name)s(%(precision)s))�namer,z"%(name)s(%(precision)s, %(scale)s))r�r,r-)r,�getattr)r2rsr�r,r-r�rt�ns        r#r�z$OracleTypeCompiler._generate_numericsq������I��=��E�7�D�1�1�E��	N�9�,��K�
�]�)�A���9�=�=�=�=�4�A���9�u�M�M�M�Mr"c��|j|fi|��SrQ)r~rrs   r#�visit_stringzOracleTypeCompiler.visit_string���"�t�"�5�/�/�B�/�/�/r"c�0�|�|dd��S)Nr��2��_visit_varcharrrs   r#r~z!OracleTypeCompiler.visit_VARCHAR2s���"�"�5�"�c�2�2�2r"c�0�|�|dd��S)N�Nr�r�rrs   r#r}z"OracleTypeCompiler.visit_NVARCHAR2s���"�"�5�#�s�3�3�3r"c�0�|�|dd��S�Nr�r�rrs   r#�
visit_VARCHARz OracleTypeCompiler.visit_VARCHARs���"�"�5�"�b�1�1�1r"c�z�|jsd||d�zS|s|jjrd}||j|d�zSd}||j||d�zS)Nz%(n)sVARCHAR%(two)s)�twor�zVARCHAR%(two)s(%(length)s CHAR))�lengthr�z%(n)sVARCHAR%(two)s(%(length)s))r�r�r�)r�r{�_supports_char_length)r2rsr��num�varchars     r#r�z!OracleTypeCompiler._visit_varchar!sl���|�	J�(�3�Q�+?�+?�?�?��	J�t�|�9�	J�7�G����S�A�A�A�A�7�G����S�q�I�I�I�Ir"c��|j|fi|��SrQ)�
visit_CLOBrrs   r#�
visit_textzOracleTypeCompiler.visit_text+rvr"c�R�|jjr|j|fi|��S|j|fi|��SrQ)r{r|�visit_NCLOBr�rrs   r#�visit_unicode_textz%OracleTypeCompiler.visit_unicode_text.sD���<�.�	0�#�4�#�E�0�0�R�0�0�0�"�4�?�5�/�/�B�/�/�/r"c��|j|fi|��SrQ)�
visit_BLOBrrs   r#�visit_large_binaryz%OracleTypeCompiler.visit_large_binary4rvr"c�"�|j|fddi|��S)Nr,�)r�rrs   r#�visit_big_integerz$OracleTypeCompiler.visit_big_integer7s"�� �t� ��;�;�"�;��;�;�;r"c��|j|fi|��SrQ)�visit_SMALLINTrrs   r#�
visit_booleanz OracleTypeCompiler.visit_boolean:r�r"c�,�|jrdd|jizSdS)NzRAW(%(length)s)r�r)r�rrs   r#�	visit_RAWzOracleTypeCompiler.visit_RAW=s#���<�	�$��%�,�'?�?�?��5r"c��dS)Nrer!rrs   r#�visit_ROWIDzOracleTypeCompiler.visit_ROWIDCs���wr")NNF)rrrruryrr�r�r�r�r�r�rxr�r�r�r~r}�visit_NVARCHARr�r�r�r�r�r�r�r�r�r!r"r#roro�s�������,�,�,�-�-�-�4�4�4�
�
�
�������G�G�G�D�D�D�C�C�C�<�<�<�=�=�=�EJ�N�N�N�N�$0�0�0�3�3�3�4�4�4�%�N�2�2�2�J�J�J�,�,�,�0�0�0�,�,�,�<�<�<�0�0�0��������r"roc���eZdZdZejejje	j
jdi��Z�fd�Zd�Z
d�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#�xZ$S)�OracleCompilerz�Oracle compiler modifies the lexical structure of Select
    statements to work under non-ANSI configured Oracle databases, if
    the use_ansi flag is False.
    �MINUSc�d��i|_i|_tt|��j|i|��dSrQ)�_OracleCompiler__wheres�_quoted_bind_namesr0r�r1)r2�args�kwargsr3s   �r#r1zOracleCompiler.__init__Rs:�����
�"$���,��n�d�#�#�,�d�=�f�=�=�=�=�=r"c�X�d|j|jfi|���d|j|jfi|���d�S)Nzmod(�, �)��process�left�right�r2�binary�operatorrts    r#�visit_mod_binaryzOracleCompiler.visit_mod_binaryWsL����D�L���+�+��+�+�+�+��D�L���,�,��,�,�,�,�
�	
r"c��dS)N�CURRENT_TIMESTAMPr!�r2�fnrts   r#�visit_now_funczOracleCompiler.visit_now_func]s��"�"r"c�$�d|j|fi|��zS)N�LENGTH)�function_argspecr�s   r#�visit_char_length_funcz%OracleCompiler.visit_char_length_func`s#���/�$�/��9�9�b�9�9�9�9r"c�t�d|�|j���d|�|j���d�S)Nz
CONTAINS (r�r�r�r�s    r#�visit_match_op_binaryz$OracleCompiler.visit_match_op_binaryc�<����L�L���%�%�%�%��L�L���&�&�&�&�
�	
r"c��dS)N�1r!�r2�exprrts   r#�
visit_truezOracleCompiler.visit_truei����sr"c��dS)N�0r!r�s   r#�visit_falsezOracleCompiler.visit_falselr�r"c��dS)N�WITHr!)r2�	recursives  r#�get_cte_preamblezOracleCompiler.get_cte_preambleor�r"c�d�d�d�|���D����S)N� c3�&K�|]\}}d|zV��
dS)z	/*+ %s */Nr!)�.0�table�texts   r#�	<genexpr>z6OracleCompiler.get_select_hint_text.<locals>.<genexpr>ss+����N�N�{�u�d��d�*�N�N�N�N�N�Nr")�join�items)r2�byfromss  r#�get_select_hint_textz#OracleCompiler.get_select_hint_textrs+���x�x�N�N�g�m�m�o�o�N�N�N�N�N�Nr"c��t|j��dks |j���tvrtjj||fi|��SdS)Nrr�)�len�clausesr��upper�
NO_ARG_FNSr�SQLCompilerr�r�s   r#r�zOracleCompiler.function_argspecusL���r�z�?�?�Q���"�'�-�-�/�/��"C�"C��'�8��r�H�H�R�H�H�H��2r"c��dS)z�Called when a ``SELECT`` statement has no froms,
        and no ``FROM`` clause is to be appended.

        The Oracle compiler tacks a "FROM DUAL" to the statement.
        z
 FROM DUALr!r>s r#�default_fromzOracleCompiler.default_from{s	���|r"c��|jjrtjj||fi|��Sd|d<t|jtj��r
|jj	}n|j}|j
|jfi|��dz|j
|fi|��zS)NT�asfromr�)r{�use_ansirr��
visit_join�
isinstancer�r�FromGrouping�elementr�r�)r2r�r�r�s    r#rzOracleCompiler.visit_join�s����<� �	��'�2�4��H�H��H�H�H�#�F�8���$�*�j�&=�>�>�
#��
�*����
�����T�Y�1�1�&�1�1����$�,�u�/�/��/�/�0�
r"c����g���fd��|D]'}t|tj��r�|���(�sdStj��S)Nc�z����jr6�fd�}��tj�jid|i����n���j���j�jfD]R}t|tj	��r�|���(t|tj
��r�|j���SdS)Nc���t|jtj��r?�j�|jj��rt|j��|_dSt|jtj��r?�j�|jj��rt|j��|_dSdSdSrQ)rr�r�ColumnClauser��is_derived_fromr��_OuterJoinColumn)r�r�s �r#�visit_binaryzVOracleCompiler._get_nonansi_join_whereclause.<locals>.visit_join.<locals>.visit_binary�s����!���Z�%<���F��*�4�4�V�[�5F�G�G�F�'7�v�{�&C�&C�����#���j�&=���F��*�4�4�V�\�5G�H�H�F�(8���'E�'E�����F�F�F�Fr"r�)�isouter�appendr�cloned_traverse�onclauser�r�rr�Joinrr)r�r�jr�rs`  ��r#rz@OracleCompiler._get_nonansi_join_whereclause.<locals>.visit_join�s������|�
.�
F�F�F�F�F�����,��
�r�H�l�+C����������t�}�-�-�-��Y��
�*�
*�
*���a���1�1�*��J�q�M�M�M�M���:�#:�;�;�*��J�q�y�)�)�)��	
*�
*r")rrrr	�and_)r2�froms�fr�rs   @@r#�_get_nonansi_join_whereclausez,OracleCompiler._get_nonansi_join_whereclause�st������	*�	*�	*�	*�	*�	*�<�	�	�A��!�Z�_�-�-�
��
�1�
�
�
���	&��4��8�W�%�%r"c�.�|j|jfi|��dzS)Nz(+))r��column)r2�vcrts   r#�visit_outer_join_columnz&OracleCompiler.visit_outer_join_column�s#���t�|�B�I�,�,��,�,�u�4�4r"c�<�|j�|��dzS)Nz.nextval)�preparer�format_sequence)r2�seqrts   r#�visit_sequencezOracleCompiler.visit_sequence�s���}�,�,�S�1�1�J�>�>r"c��d|zS)z+Oracle doesn't like ``FROM table AS alias``r�r!)r2�alias_name_texts  r#�get_render_as_alias_suffixz)OracleCompiler.get_render_as_alias_suffix�s���_�$�$r"c��g}g}ttj|����D�]�\}}|jrTt	|t
j��r:t	|jt��r |j	j
stjd��|j
jr|j
�|��}n|}t!jd|z|j
���}||j|j<|�|�|�|������|�|�|d�����|�t3|d|j��t3|d|j��|t3|dd��t3|dd��f|j
�����dd	�|��zd
zd	�|��zS)NakComputed columns don't work with Oracle UPDATE statements that use RETURNING; the value of the column *before* the UPDATE takes place is returned.   It is advised to not use RETURNING with an Oracle computed column.  Consider setting implicit_returning to False on the Table object in order to avoid implicit RETURNING clauses from being generated for this Table.zret_%d)rsF)�within_columns_clauser��keyz
RETURNING r�z INTO )�	enumerater�_select_iterables�isupdater�	sa_schema�Column�server_defaultrr{�(_supports_update_returning_computed_colsr�warn�type�_has_column_expression�column_expressionr	�outparam�bindsr%r�bindparam_string�_truncate_bindparamr��_add_to_result_mapr��
anon_labelr�)	r2�stmt�returning_cols�columnsr2�ir�col_exprr1s	         r#�returning_clausezOracleCompiler.returning_clause�s�������"��(��8�8�
�
�'	�'	�I�A�v��
�
��v�y�'7�8�8�
��v�4�h�?�?�
���M�	
��	�C�����{�1�
"�!�;�8�8��@�@���!���|�H�q�L���D�D�D�H�'/�D�J�x�|�$��L�L��%�%�d�&>�&>�x�&H�&H�I�I�
�
�
�
�N�N�4�<�<���<�N�N�O�O�O��#�#���&�(�*=�>�>���&�(�*=�>�>���F�F�D�1�1��F�E�4�0�0��
��	
�	
�	
�	
��d�i�i��0�0�0�8�;�d�i�i��>N�>N�N�Nr"c��dS)z_Need to determine how to get ``LIMIT``/``OFFSET`` into a
        ``UNION`` for Oracle.
        Nr!)r2�selects  r#�_TODO_visit_compound_selectz*OracleCompiler._TODO_visit_compound_select�s	��	
�r"c�t��t|dd���s|jjs]|�||�dd����}|�|��}|�|�|��}d|_|j}|j	}|�|���||d<|�
��}d|_tjd�|j
D����}|�0|jjr$|jr|�d|jz��}d|_d|_|j}|�z|jrs|���}|���|jD]}	|�|	���t1j|����fd	�|jD��|_|�k|jjs+|j}
|�
|
|jz
}
tjd
|
z��}
n	|}
|�|
|z}
|�tjd��|
k��|�||_|}�n|�tjd���d����}d|_d|_tjd
�|j
D����}d|_d|_|�;|jr4|jD],}	|� |	���|�|	���-|jjstjd
|jz��}|�tjd��|k��||_|}tCj"j#||fi|��S)z�Look for ``LIMIT`` and OFFSET in a select statement, and if
        so tries to wrap it in a subquery with ``rownum`` criterion.
        �
_oracle_visitNrFT�select_wraps_forc��g|]}|��Sr!r!�r��cs  r#�
<listcomp>z/OracleCompiler.visit_select.<locals>.<listcomp> s��)>�)>�)>��!�)>�)>�)>r"z/*+ FIRST_ROWS(%d) */c�:��g|]}��|����Sr!)�traverse)r��elem�adapters  �r#rFz/OracleCompiler.visit_select.<locals>.<listcomp>7s4���%�%�%�37��(�(��.�.�%�%�%r"z%d�ROWNUM�ora_rnc�(�g|]}|jdk�
|��S)rL)r%rDs  r#rFz/OracleCompiler.visit_select.<locals>.<listcomp>Ys$��G�G�G�q�Q�U�h�5F�5F��5F�5F�5Fr")$r�r{r�_display_froms_for_select�getr�whererA�
_limit_clause�_offset_clause�	_generater	r>rE�optimize_limits�_simple_int_limit�prefix_with�_limit�_is_wrapper�_for_update_arg�of�_clone�_copy_internals�
append_column�sql_util�
ClauseAdapter�use_binds_for_limits�_offset�literal_column�append_whereclauser�label�corresponding_columnrr��visit_select)
r2r>r�r�whereclause�limit_clause�
offset_clause�limitselect�
for_updaterI�max_row�offsetselectrJs
            @r#rfzOracleCompiler.visit_select�s����
�v���5�5�j	*��<�(�
0��6�6��F�J�J�x��7�7����#�@�@��G�G���*�#�\�\�+�6�6�F�+/�F�(�!�/�L�"�1�M��'�=�+D�.4��)�*��)�)�+�+��'+��$�"�j�)>�)>�V�X�)>�)>�)>�?�?�� �,���4�-��0�-�#.�"9�"9�/�&�-�?�#�#�K�-1��)�*.��'�$�3�
��)�j�m�)�!+�!2�!2�!4�!4�J��.�.�0�0�0� *�
�3�3���,�,�T�2�2�2�2�&�4�V�<�<�G�%�%�%�%�;E�=�%�%�%�J�M�
 �+��<�<�>�#)�-��(�4�#�v�~�5�G�"%�"4�T�G�^�"D�"D���".��(�4�&-�
�&=�G��2�2��*�8�4�4��?����
!�(�2<�K�/�(�F�F�"-�"4�"4��*�8�4�4�:�:�8�D�D�#�#�K�15�K�-�.2�K�+�#&�:�G�G�K�M�G�G�G�$�$�L�26�L�.�/3�L�,�!�-�*�-�-�$.�M�@�@�D�*�?�?��E�E�M� +� 9� 9�$� ?� ?� ?���<�<��(+�(:� �6�>�1�)�)�
�!�3�3��*�8�4�4�}�D����4>�L�0�)�F��#�0��v�H�H��H�H�Hr"c��dSr�r!)r2r>rts   r#rhzOracleCompiler.limit_clauseps���rr"c��dS)NzSELECT 1 FROM DUAL WHERE 1!=1r!)r2rss  r#�visit_empty_set_exprz#OracleCompiler.visit_empty_set_exprss��.�.r"c��������rdSd}|jjr2|dd���fd�|jjD����zz
}|jjr|dz
}|jjr|dz
}|S)Nr�z FOR UPDATEz OF r�c3�4�K�|]}�j|fi���V��dSrQ)r�)r�rIrtr2s  ��r#r�z3OracleCompiler.for_update_clause.<locals>.<genexpr>}sH�����&�&�-1����T�(�(�R�(�(�&�&�&�&�&�&r"z NOWAITz SKIP LOCKED)�is_subqueryrYrZr��nowait�skip_locked)r2r>rt�tmps` ` r#�for_update_clausez OracleCompiler.for_update_clausevs����������	��2����!�$�	��6�D�I�I�&�&�&�&�&�5;�5K�5N�&�&�&����
�C��!�(�	��9��C��!�-�	"��>�!�C��
r"c�t�d|�|j���d|�|j���d�S)N�DECODE(r�z, 0, 1) = 1r�r�s    r#�visit_is_distinct_from_binaryz,OracleCompiler.visit_is_distinct_from_binary�r�r"c�t�d|�|j���d|�|j���d�S)Nryr�z, 0, 1) = 0r�r�s    r#� visit_isnot_distinct_from_binaryz/OracleCompiler.visit_isnot_distinct_from_binary�r�r")%rrrrVr�update_copyrr��compound_keywordsr�CompoundSelect�EXCEPTr1r�r�r�r�r�r�r�r�r�r�rrrrr"r<r?rfrhrprwrzr|rBrCs@r#r�r�Gs����������
)��(���.�	�	"�	)�7�3����
>�>�>�>�>�

�
�
�#�#�#�:�:�:�
�
�
����������O�O�O�������
�
�
�(&�(&�(&�T5�5�5�?�?�?�%�%�%�
-O�-O�-O�^
�
�
�qI�qI�qI�f���/�/�/����$
�
�
�
�
�
�
�
�
�
r"r�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�OracleDDLCompilerc�h�d}|j�
|d|jzz
}|j�tjd��|S)Nr�z
 ON DELETE %sz�Oracle does not contain native UPDATE CASCADE functionality - onupdates will not be rendered for foreign keys.  Consider using deferrable=True, initially='deferred' or triggers.)�ondelete�onupdaterr-)r2�
constraintr�s   r#�define_constraint_cascadesz,OracleDDLCompiler.define_constraint_cascades�sM������*��O�j�&9�9�9�D�
��*��I��
�
�
��r"c�F�d|j�|j��zS)NzCOMMENT ON TABLE %s IS '')r�format_tabler)r2�drops  r#�visit_drop_table_commentz*OracleDDLCompiler.visit_drop_table_comment�s(��*�T�]�-G�-G��L�.
�.
�
�	
r"c
����|j}��|���j}d}|jr|dz
}|jddr|dz
}|d��|d����d	|�|jd�
���dd��fd
�|j	D�����d�z
}|jdddur4|jdddur|dz
}n|d|jddzz
}|S)NzCREATE zUNIQUE �oracle�bitmapzBITMAP zINDEX T)�include_schemaz ON )�
use_schemaz (r�c3�R�K�|]!}�j�|dd���V��"dS)FT��
include_table�
literal_bindsN)�sql_compilerr�)r�r�r2s  �r#r�z7OracleDDLCompiler.visit_create_index.<locals>.<genexpr>�sX���������!�)�)���T�*��������r"r��compressFz	 COMPRESSz COMPRESS %d)
r�_verify_index_tabler�unique�dialect_options�_prepared_index_namer�r�r��expressions)r2�create�indexrr�s`    r#�visit_create_indexz$OracleDDLCompiler.visit_create_index�sT������� � ��'�'�'��=�����<�	��I��D�� ��*�8�4�	��I��D����%�%�e�D�%�A�A�A�A��!�!�%�+�$�!�?�?�?�?��I�I�����"�-�	���
�
�
�
�	
�		
��� ��*�:�6�e�C�C��$�X�.�z�:�d�B�B���#������)�(�3�J�?�����r"c�r�g}|jd}|drF|d�dd�����}|�d|z��|dr>|ddur|�d��n|�d	|dz��d
�|��S)Nr��	on_commit�_r�z
 ON COMMIT %sr�Tz

 COMPRESSz
 COMPRESS FOR %sr�)r��replacer�rr�)r2r��
table_opts�opts�on_commit_optionss     r#�post_create_tablez#OracleDDLCompiler.post_create_table�s����
��$�X�.�����	E� $�[� 1� 9� 9�#�s� C� C� I� I� K� K�����/�2C�C�D�D�D��
��	M��J��4�'�'��!�!�-�0�0�0�0��!�!�"6�$�z�:J�"K�L�L�L��w�w�z�"�"�"r"c��d|j�|jdd���z}|jdurt	jd���|jdur|dz
}|S)NzGENERATED ALWAYS AS (%s)FTr�zzOracle computed columns do not support 'stored' persistence; set the 'persisted' flag to None or False for Oracle support.z VIRTUAL)r�r��sqltext�	persistedr�CompileError)r2�	generatedr�s   r#�visit_computed_columnz'OracleDDLCompiler.visit_computed_column�s{��)�D�,=�,E�,E���U�$�-F�-
�-
�
����$�&�&��"�P���
��
 �E�
)�
)��J��D��r"N)rrrr�r�r�r�r�r!r"r#r�r��s_���������$
�
�
�
���8#�#�#� ����r"r�c���eZdZd�eD��Zd�edd��D���ddg��Zd�Z�fd�Z	�xZ
S)	�OracleIdentifierPreparerc�6�h|]}|�����Sr!)�lower�r��xs  r#�	<setcomp>z"OracleIdentifierPreparer.<setcomp>�s ��8�8�8�A�a�g�g�i�i�8�8�8r"c�,�h|]}t|����Sr!)�str)r��digs  r#r�z"OracleIdentifierPreparer.<setcomp>�s��!C�!C�!C�s�#�c�(�(�!C�!C�!Cr"r�
r��$c��|���}||jvp;|d|jvp,|j�tj|����S)z5Return True if the given identifier requires quoting.r)r��reserved_words�illegal_initial_characters�legal_characters�matchr�	text_type)r2�value�lc_values   r#�_bindparam_requires_quotesz3OracleIdentifierPreparer._bindparam_requires_quotes�s[���;�;�=�=����+�+�
F��Q�x�4�:�:�
F��(�.�.�t�~�e�/D�/D�E�E�E�	
r"c���|j�d��}tt|���||��S)Nr�)�ident�lstripr0r��format_savepoint)r2�	savepointr�r3s   �r#r�z)OracleIdentifierPreparer.format_savepoint�s@�����%�%�c�*�*���-�t�4�4�E�E��t�
�
�	
r")rrr�RESERVED_WORDSr��range�unionr�r�r�rBrCs@r#r�r��s��������8�8��8�8�8�N�!C�!C�e�e�A�r�l�l�!C�!C�!C�!I�!I�	�c�
�"�"��
�
�
�
�
�
�
�
�
�
�
�
r"r�c��eZdZd�ZdS)�OracleExecutionContextc�j�|�d|j�|��zdz|��S)NzSELECT z.nextval FROM DUAL)�_execute_scalar�identifier_preparerr)r2rrss   r#�
fire_sequencez$OracleExecutionContext.fire_sequence�sC���#�#���&�6�6�s�;�;�
<�"�
#�
�	
�
�	
r"N)rrrr�r!r"r#r�r��s#������
�
�
�
�
r"r�c���eZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
eZeZdZdZdZdZeZeZeZeZeZdZdZe j!dddd�fe j"ddd	�fgZ#					d/d�Z$�fd�Z%d
�Z&e'd���Z(e'd���Z)e'd���Z*e'd���Z+e'd���Z,d�Z-d�Z.�fd�Z/ddgZ0d�Z1d�Z2d�Z3d0d�Z4d0d�Z5d�Z6			d1d�Z7e8j9			d2d ���Z:e8j9d!���Z;e8j9d0d"���Z<e8j9d#���Z=e8j9d0d$���Z>e8j9d0d%���Z?e8j9d0d&���Z@e8j9			d2d'���ZAe8j9			d2d(���ZBe8j9	d3d)���ZCe8j9d0d*���ZDe8j9d0d+���ZEe8j9	d0d,���ZFe8j9			d2d-���ZGe8j9	d4d.���ZH�xZIS)5�
OracleDialectr�TF��named)�oracle_resolve_synonymsN)�resolve_synonymsr�r�)r�r���SYSTEM�SYSAUXc�z�tjj|fi|��||_||_||_||_||_dSrQ)r�DefaultDialectr1r|rrTr`�exclude_tablespaces)r2rrTr`�use_nchar_for_unicoder�r�s       r#r1zOracleDialect.__init__1sM��	��'��7�7��7�7�7�&;��#� ��
�.���$8��!�#6�� � � r"c�N��tt|���|��|j�d|jdk��|_|jrK|j�	��|_|j�
tj��d|_
dSdS)N�implicit_returning)r�F)r0r��
initialize�__dict__rO�server_version_infor��_is_oracle_8�colspecs�copy�popr;rbr)r2�
connectionr3s  �r#r�zOracleDialect.initializeAs����
�m�T�"�"�-�-�j�9�9�9�"&�-�"3�"3� �$�":�U�"B�#
�#
�����	"� �M�.�.�0�0�D�M��M���h�/�0�0�0�!�D�M�M�M�	"�	"r"c�.�|jdkr|jS	|�d�����}n#tj$rd}YnwxYw|r;	td�|�d��D����S#|jcYSxYw|jS)N���z7SELECT value FROM v$parameter WHERE name = 'compatible'c3�4K�|]}t|��V��dSrQ)�intr�s  r#r�zJOracleDialect._get_effective_compat_server_version_info.<locals>.<genexpr>\s(����?�?��S��V�V�?�?�?�?�?�?r"�.)r��execute�scalarr�
DBAPIError�tuple�split)r2r��compats   r#�)_get_effective_compat_server_version_infoz7OracleDialect._get_effective_compat_server_version_infoMs����#�g�-�-��+�+�	��'�'�I����f�h�h�
�F���~�	�	�	��F�F�F�	�����	,�
0��?�?�V�\�\�#�->�->�?�?�?�?�?�?��
0��/�/�/�/�����+�+s�'<�A�A�+B�	B
c�&�|jo
|jdkS)N)�	�r�r>s r#r�zOracleDialect._is_oracle_8bs���'�K�D�,D�t�,K�Kr"c�&�|jo
|jdkS)N)r��r�r>s r#�_supports_table_compressionz)OracleDialect._supports_table_compressionfs���'�O�D�,D��,O�Or"c�&�|jo
|jdkS)N)�r�r>s r#�_supports_table_compress_forz*OracleDialect._supports_table_compress_forjs���'�M�D�,D��,M�Mr"c��|jSrQ)r�r>s r#r�z#OracleDialect._supports_char_lengthns���$�$�$r"c�&�|jo
|jdkS)N)�r�r>s r#r,z6OracleDialect._supports_update_returning_computed_colsrs���'�M�D�,D��,M�Mr"c��dSrQr!)r2r�r�s   r#�do_release_savepointz"OracleDialect.do_release_savepointxs���r"c�r�|�|��dkrtjd|j�d���dS)Nr�zOracle version a is known to have a maximum identifier length of 128, rather than the historical default of 30. SQLAlchemy 1.4 will use 128 for this database; please set max_identifier_length=128 in create_engine() in order to test the application with this new length, or set to 30 in order to assure that 30 continues to be used.  In particular, pay close attention to the behavior of database migrations as dynamically generated names may change. See the section 'Max Identifier Lengths' in the SQLAlchemy Oracle dialect documentation for background.)r�rr-r��r2r�s  r#�_check_max_identifier_lengthz*OracleDialect._check_max_identifier_length|sU���9�9�*�E�E�J
�
�
�
�I�I��,�,�,�0�

�

�

� �tr"c����tjtjd��tjd����g}tt|���||��S)Nz'test nvarchar2 returns'�<)r�castrbr;rr0r��_check_unicode_returns)r2r��additional_testsr3s   �r#r	z$OracleDialect._check_unicode_returns�sa����O��)�*D�E�E��!�"�%�%�
�
�
���]�D�)�)�@�@��(�
�
�	
r"�READ COMMITTED�SERIALIZABLEc� �td����Nz implemented by cx_Oracle dialect��NotImplementedErrorrs  r#�get_isolation_levelz!OracleDialect.get_isolation_level����!�"D�E�E�Er"c�R�	|�|��S#t$r�YdSxYw)Nr)rr)r2�
dbapi_conns  r#�get_default_isolation_levelz)OracleDialect.get_default_isolation_level�sB��	$��+�+�J�7�7�7��"�	�	�	��	$�#�#�#���s��&c� �td���rr)r2r��levels   r#�set_isolation_levelz!OracleDialect.set_isolation_level�rr"c���|s|j}|�tjd��|�|��|�|�����}|���duS)NzSSELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_name�r��schema_name��default_schema_namer�r	r��denormalize_name�first)r2r��
table_namer�cursors     r#�	has_tablezOracleDialect.has_table�sz���	.��-�F��#�#��H�D�
�
��&�&�z�2�2��-�-�f�5�5�
$�
�
���|�|�~�~�T�)�)r"c���|s|j}|�tjd��|�|��|�|�����}|���duS)NzeSELECT sequence_name FROM all_sequences WHERE sequence_name = :name AND sequence_owner = :schema_namerr)r2r��
sequence_namerr!s     r#�has_sequencezOracleDialect.has_sequence�sy���	.��-�F��#�#��H�0�
�
�
�&�&�}�5�5��-�-�f�5�5�$�
�
���|�|�~�~�T�)�)r"c�v�|�|�d�������S)NzSELECT USER FROM DUAL)�normalize_namer�r�rs  r#�_get_default_schema_namez&OracleDialect._get_default_schema_name�s8���"�"����6�7�7�>�>�@�@�
�
�	
r"c�x�d}g}i}|r|�d��||d<|r|�d��||d<|r|�d��||d<|d�|��z
}|jtj|��fi|��}|r6|���}	|	r|	d	|	d
|	d|	dfSdS|���}
t|
��d
krtd���t|
��d
kr&|
d}	|	d	|	d
|	d|	dfSdS)z�search for a local synonym matching the given desired owner/name.

        if desired_owner is None, attempts to locate a distinct owner.

        returns the actual name, owner, dblink name, and synonym name if
        found.
        zUSELECT owner, table_owner, table_name, db_link, synonym_name FROM all_synonyms WHERE zsynonym_name = :synonym_name�synonym_namezowner = :desired_owner�
desired_ownerztable_name = :tname�tnamez AND r �table_owner�db_link�NNNNr�zGThere are multiple tables visible to the schema, you must specify ownerr)	rr�r�r	r�r�fetchallr��AssertionError)r2r�r+�desired_synonym�
desired_table�qr��params�result�row�rowss           r#�_resolve_synonymzOracleDialect._resolve_synonym�s��� 
4�	
������	5��N�N�9�:�:�:�%4�F�>�"��	4��N�N�3�4�4�4�&3�F�?�#��	,��N�N�0�1�1�1�+�F�7�O�	�W�\�\�'�
"�
"�"��#��#�C�H�Q�K�K�:�:�6�:�:���	.��,�,�.�.�C��
.���%��
�&��	�N���'�	��.�-��?�?�$�$�D��4�y�y�1�}�}�$�)�����T���a����1�g����%��
�&��	�N���'�	��.�-r"r�c�x�|rD|�||�|��|�|�����\}}}}	nd\}}}}	|s|�|��}|r/|�tjd��|���}d|z}n|s|�|p|j��}|||pd|	fS)N)r+r2r/z6SELECT username FROM user_db_links WHERE db_link=:link)�link�@r�)r9rr�r	r�r)
r2r�r rr��dblinkrt�actual_name�owner�synonyms
          r#�_prepare_reflection_argsz&OracleDialect._prepare_reflection_args
s���	I�26�2G�2G��"�3�3�F�;�;� $� 5� 5�j� A� A�3H�3�3�/�K�����3I�/�K�����	<��/�/�
�;�;�K��	N��%�%���O����	&���E��6�\�F�F��	N��)�)�&�*L�D�4L�M�M�E��U�F�L�b�'�:�:r"c�N��d}|�|��}�fd�|D��S)Nz0SELECT username FROM all_users ORDER BY usernamec�F��g|]}��|d����S�r�r'�r�r7r2s  �r#rFz2OracleDialect.get_schema_names.<locals>.<listcomp>9�+���>�>�>���#�#�C��F�+�+�>�>�>r")r�)r2r�rt�sr!s`    r#�get_schema_nameszOracleDialect.get_schema_names5s5���>���#�#�A�&�&��>�>�>�>�v�>�>�>�>r"c�,����|p�j��}|��j}d}�jr*|dd�d��jD����zz
}|dz
}|�tj|��|���}�fd�|D��S)N�(SELECT table_name FROM all_tables WHERE �6nvl(tablespace_name, 'no tablespace') NOT IN (%s) AND r�c��g|]}d|z��S�z'%s'r!�r��tss  r#rFz1OracleDialect.get_table_names.<locals>.<listcomp>H���M�M�M�b�f�r�k�M�M�Mr"z8OWNER = :owner AND IOT_NAME IS NULL AND DURATION IS NULL�r?c�F��g|]}��|d����SrDrErFs  �r#rFz1OracleDialect.get_table_names.<locals>.<listcomp>OrGr"�rrr�r�r�r	r�)r2r�rrt�sql_strr!s`     r#�get_table_nameszOracleDialect.get_table_names;s�����&�&�v�'I��1I�J�J���>��-�F�<���#�	��#��9�9�M�M�D�4L�M�M�M�N�N�P�
�G�
	�L�	
���#�#�C�H�W�$5�$5�V�#�D�D��>�>�>�>�v�>�>�>�>r"c������j��}d}�jr*|dd�d��jD����zz
}|dz
}|�tj|��|���}�fd�|D��S)NrKrLr�c��g|]}d|z��SrNr!rOs  r#rFz6OracleDialect.get_temp_table_names.<locals>.<listcomp>ZrQr"z<OWNER = :owner AND IOT_NAME IS NULL AND DURATION IS NOT NULLrRc�F��g|]}��|d����SrDrErFs  �r#rFz6OracleDialect.get_temp_table_names.<locals>.<listcomp>crGr"rT)r2r�rtrrUr!s`     r#�get_temp_table_namesz"OracleDialect.get_temp_table_namesQs�����&�&�t�'?�@�@��<���#�	��#��9�9�M�M�D�4L�M�M�M�N�N�P�
�G�
	�
'�	
���#�#�C�H�W�$5�$5�V�#�D�D��>�>�>�>�v�>�>�>�>r"c������|p�j��}tjd��}|�|��|�����}�fd�|D��S)Nz4SELECT view_name FROM all_views WHERE owner = :ownerrRc�F��g|]}��|d����SrDrErFs  �r#rFz0OracleDialect.get_view_names.<locals>.<listcomp>jrGr")rrr	r�r�)r2r�rrtrHr!s`     r#�get_view_nameszOracleDialect.get_view_namesesn����&�&�v�'I��1I�J�J���H�K�L�L���#�#�A�T�-B�-B�6�-J�-J�#�K�K��>�>�>�>�v�>�>�>�>r"c��i}|�dd��}|�dd��}|�d��}|�||||||���\}}}}	d|i}
dg}|jr|�d��|jr|�d	��d
}|�
||
d<|dz
}||d
�|��d�z}|jtj|��fi|
��}
tdd���}|
�
��}|r3d|vr/|�|jd��rd	|vr|j|d<nd|d<|S)Nr�Fr=r��
info_cache�r_r �compression�compress_forzKSELECT %(columns)s FROM ALL_TABLES%(dblink)s WHERE table_name = :table_namer?z AND owner = :owner r�)r=r9T��DISABLED�ENABLED�oracle_compress)
rOrAr�rr�r�r�r	r��dictrrarb)r2r�r rrt�optionsr�r=r_r@r5r9r�r6�enabledr7s                r#�get_table_optionszOracleDialect.get_table_optionsls������6�6�";�U�C�C������"�%�%���V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W��
�+���.���+�	*��N�N�=�)�)�)��,�	+��N�N�>�*�*�*�
-�	
���$�F�7�O��*�*�D���D�I�I�g�4F�4F�G�G�G��#��#�C�H�T�N�N�=�=�f�=�=����t�4�4�4���l�l�n�n���	6���#�#����C�O�U�(K�(K�#�!�S�(�(�14�1A�G�-�.�.�15�G�-�.��r"c	��|�dd��}|�dd��}|�d��}|�||||||���\}}}}g}	|jrd}
nd}
d	|i}d
}|�
||d<|d
z
}|dz
}|||
d�z}|jt	j|��fi|��}
|
D�]�}|�|d��}|d}|d}|d}|d}|d}|ddk}|d}|d}|d}|dkr(|�|dkrt��}n�t||��}n�|dkrt��}n�|dvr$|j
�|��|��}nqd|vrtd���}n\tj
d d|��}	|j
|}n7#t$r*tjd!|�d"|�d#���t"j}YnwxYw|d$krt'|�%��}d}nd}||||d&|d'�}|���|krd|d(<|�||d)<|	�|�����|	S)*�a

        kw arguments can be:

            oracle_resolve_synonyms

            dblink

        r�Fr=r�r_r`�char_length�data_lengthr a
            SELECT col.column_name, col.data_type, col.%(char_length_col)s,
              col.data_precision, col.data_scale, col.nullable,
              col.data_default, com.comments, col.virtual_column            FROM all_tab_cols%(dblink)s col
            LEFT JOIN all_col_comments%(dblink)s com
            ON col.table_name = com.table_name
            AND col.column_name = com.column_name
            AND col.owner = com.owner
            WHERE col.table_name = :table_name
            AND col.hidden_column = 'NO'
        Nr?z AND col.owner = :owner z ORDER BY col.column_id)r=�char_length_colrr�r�r���Y���r*r)r(rkrrzWITH TIME ZONETr�z\(\d+\)zDid not recognize type 'z
' of column '�'�YES)r��auto)r�r.�nullabler�
autoincrement�comment�quote�computed)rOrAr�r�r	r�r'rr*r�
ischema_namesr�re�sub�KeyErrorrr-r;�NULLTYPErgr�r)r2r�r rrtr�r=r_r@r9ror5r�rEr7�colname�orig_colname�coltyper�r,r-ryrr{r�r}�cdicts                           r#�get_columnszOracleDialect.get_columns�s���6�6�";�U�C�C������"�%�%���V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W����%�	,�+�O�O�+�O��
�+������$�F�7�O��.�.�D��)�)����O�L�L�L���J��s�x��~�~�8�8��8�8���6	"�6	"�C��)�)�#�a�&�1�1�G��q�6�L��!�f�G���V�F��A��I���F�E��1�v��}�H��!�f�G��!�f�G��A��I��(�"�"��$��!���%�i�i�G�G�$�Y��6�6�G�G��G�#�#��'�'����F�F�F�9�$�,�0�0��9�9�&�A�A���!�W�,�,�#�T�2�2�2����&��R��9�9��0�"�0��9�G�G���0�0�0��I�I�"�7�7�G�G�G�-����'�/�G�G�G�0�����E�!�!���0�0�0������� ��$�"�!'�"�
��E��!�!�#�#�|�3�3�!%��g���#�$,��j�!��N�N�5�!�!�!�!��s�2
G�1G4�3G4c��|�d��}|�||||||���\}}}}|s|j}d}	|�t	j|	��||���}
d|
���iS)Nr_r`z�
            SELECT comments
            FROM all_tab_comments
            WHERE table_name = :table_name AND owner = :schema_name
        )r rr�)rOrArr�r	r�r�)r2r�r rr�r=rtr_r@�COMMENT_SQLrEs           r#�get_table_commentzOracleDialect.get_table_comment
s����V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W��	.��-�F���
����H�[�!�!�j�f�
�
�
������
�
�#�#r"c
��|�d��}|�||||||���\}}}}g}	d|i}
d}|�
||
d<|dz
}|dz
}|d|iz}tj|��}|j|fi|
��}
g}	d}|�||||||�d���	��}t
d
d���}t
d
d�
��}tjdtj	��}d}|
D�]}|�
|j��}|r
||dkr�,|j|kr't
|gi���}|	�|��|�|j
d
��|d<|jdvrd|dd<|�|jd
��r|j|dd<|�|j��s3|d�|�
|j����|j}��|	S)Nr_r`r a$SELECT a.index_name, a.column_name, 
b.index_type, b.uniqueness, b.compression, b.prefix_length 
FROM ALL_IND_COLUMNS%(dblink)s a, 
ALL_INDEXES%(dblink)s b 
WHERE 
a.index_name = b.index_name 
AND a.table_owner = b.table_owner 
AND a.table_name = b.table_name 
AND a.table_name = :table_name rzAND a.table_owner = :schema z(ORDER BY a.index_name, a.column_positionr=)r�r=r_FT)�	NONUNIQUE�UNIQUErczSYS_NC\d+\$r�)r��column_namesr�r�)�BITMAPzFUNCTION-BASED BITMAPr��
oracle_bitmaprfr�)rOrAr	r�r��get_pk_constraintrgr�compile�
IGNORECASEr'�
index_namer�
uniqueness�
index_typera�
prefix_lengthr��column_name)r2r�r rr�r=rtr_r@�indexesr5r�r4�rp�last_index_name�
pk_constraintr�ri�oracle_sys_colr��rset�index_name_normalizeds                      r#�get_indexeszOracleDialect.get_indexes-s����V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W����
�+��
0�	
���%�F�8���2�2�D��:�:���x��(�(���H�T�N�N��
�Z�
��
,�
,�V�
,�
,�������.�.����-���v�v�l�+�+�
/�
�
�
��E�$�7�7�7�
���t�4�4�4����N�B�M�B�B�����$	.�$	.�D�$(�$7�$7���$H�$H�!��
�)�]�6�-B�B�B����/�1�1��.�!#�$&�����
���u�%�%�%�(�n�n�T�_�e�D�D�E�(�O���"E�E�E�<@��'�(��9��{�{�4�+�U�3�3�
'��&��'�(�%��"�'�'��(8�9�9�
��n�%�,�,��'�'��(8�9�9����#�o�O�O��r"c��d|i}d}|�
||d<|dz
}|dz
}|d|iz}|jtj|��fi|��}|���}	|	S)Nr a�SELECT
ac.constraint_name,
ac.constraint_type,
loc.column_name AS local_column,
rem.table_name AS remote_table,
rem.column_name AS remote_column,
rem.owner AS remote_owner,
loc.position as loc_pos,
rem.position as rem_pos,
ac.search_condition,
ac.delete_rule
FROM all_constraints%(dblink)s ac,
all_cons_columns%(dblink)s loc,
all_cons_columns%(dblink)s rem
WHERE ac.table_name = :table_name
AND ac.constraint_type IN ('R','P', 'U', 'C')r?z
AND ac.owner = :ownerz�
AND ac.owner = loc.owner
AND ac.constraint_name = loc.constraint_name
AND ac.r_owner = rem.owner(+)
AND ac.r_constraint_name = rem.constraint_name(+)
AND (rem.position IS NULL or loc.position=rem.position)
ORDER BY ac.constraint_name, loc.positionr=)r�r	r�r0)
r2r�r rr=rtr5r�r��constraint_datas
          r#�_get_constraint_dataz"OracleDialect._get_constraint_data�s���
�
�+��
>�	
�&��$�F�7�O��-�-�D��
:�	
���x��(�(��
�Z�
������
9�
9�&�
9�
9���+�+�-�-���r"c	�
��|�dd��}|�dd��}|�d��}��||||||���\}}}}g}	d}
��|||||�d�����}|D]i}|dd�t�fd	�|dd
�D����z\}
}}}}}|dkr,|
���|
��}
|	�|���j|	|
d�S)
Nr�Fr=r�r_r`rr�c�:��g|]}��|����Sr!rE�r�r�r2s  �r#rFz3OracleDialect.get_pk_constraint.<locals>.<listcomp>��'���!K�!K�!K�Q�$�"5�"5�a�"8�"8�!K�!K�!Kr"rs�P)�constrained_columnsr�)rOrAr�r�r'r)r2r�r rrtr�r=r_r@�pkeys�constraint_namer�r7�	cons_name�	cons_type�local_column�remote_table�
remote_column�remote_owners`                  r#r�zOracleDialect.get_pk_constraint�sW����6�6�";�U�C�C������"�%�%���V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W������3�3������v�v�l�+�+�4�
�
��#�	+�	+�C��A�a�C��5�!K�!K�!K�!K�#�a��c�(�!K�!K�!K�L�L�L�
��������C���"�*�&*�&9�&9�)�&D�&D�O����\�*�*�*��',�o�F�F�Fr"c	���|}|�dd��}|�dd��}|�d��}��||||||���\}}}}	��|||||�d�����}
d�}tj|��}|
D�]r}
|
dd	�t�fd
�|
d	d�D����z\}}}}}}��|��}|dk�r|�tjdd|iz���p||}||d<|d|d}}|ds�|ro��|��	|����	|�����\}}}}|r*��|��}��|��}||d<|���	|��|kr||d<|
ddkr|
d|dd<|�
|��|�
|����tt|�����S)rlr�Fr=r�r_r`c��dgddgid�S)N)r�r��referred_schema�referred_table�referred_columnsrhr!r!r"r#�fkey_recz0OracleDialect.get_foreign_keys.<locals>.fkey_recs#���')�#'�"&�$&��
��
r"rr�c�:��g|]}��|����Sr!rEr�s  �r#rFz2OracleDialect.get_foreign_keys.<locals>.<listcomp>r�r"rs�RNzqGot 'None' querying 'table_name' from all_cons_columns%(dblink)s - does the user have proper rights to the table?r�r�r�r�)r+r3r�r�z	NO ACTIONrhr�)
rOrAr�r�defaultdictr�r'r-r9rr�list�values)r2r�r rrt�requested_schemar�r=r_r@r�r��fkeysr7r�r�r�r�r�r��rec�
local_cols�remote_cols�ref_remote_name�ref_remote_owner�
ref_dblink�ref_synonyms`                          r#�get_foreign_keyszOracleDialect.get_foreign_keys�s����"���6�6�";�U�C�C������"�%�%���V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W��3�3������v�v�l�+�+�4�
�
��	�	�	�� ��*�*��"�>	2�>	2�C��A�a�C��5�!K�!K�!K�!K�#�a��c�(�!K�!K�!K�L�L�L�
��������+�+�I�6�6�I��C����'��I�:�$�V�,�-������I�&��'��F���-�.��*�+�(�
�
�+�,�<�'��!�1�1�&�*.�*?�*?��*M�*M�*.�*?�*?��*M�*M�2����+�,�&�'�'��+/�+>�+>�{�+K�+K�L�+/�+>�+>� 0�,�,�L�-9�C�(�)�)�4��0�0��>�>�&�H�H�1=��-�.��1�v��,�,�58��V��I��z�2��!�!�,�/�/�/��"�"�=�1�1�1���E�L�L�N�N�#�#�#r"c	�����|�dd��}|�dd��}|�d��}��||||||���\}}}}��|||||�d�����}	td�|	��}
t	|
d���}d	���|||�
��D����fd��fd�|D��D��S)
Nr�Fr=r�r_r`c��|ddkS)Nr��Ur!�r�s r#�<lambda>z6OracleDialect.get_unique_constraints.<locals>.<lambda>ns��q��t�s�{�r"c��|dSr:r!r�s r#r�z6OracleDialect.get_unique_constraints.<locals>.<lambda>os
��q��t�r"c��h|]
}|d��S)r�r!)r��ixs  r#r�z7OracleDialect.get_unique_constraints.<locals>.<setcomp>qs,��
�
�
��
�v�J�
�
�
r"rc�.��g|]\}}|||�vr|ndd���S)N)r�r��duplicates_indexr!)r�r��cols�index_namess   �r#rFz8OracleDialect.get_unique_constraints.<locals>.<listcomp>usM���

�

�

���d�	� $�,0�K�,?�,?�D�D�T�
�
�

�

�

r"c�n��g|]1}��|d���fd�|dD��g��2S)rc�F��g|]}��|d����S)r�rEr�s  �r#rFzCOracleDialect.get_unique_constraints.<locals>.<listcomp>.<listcomp>~s+���=�=�=�1�T�(�(��1��.�.�=�=�=r"r�rE)r�r:r2s  �r#rFz8OracleDialect.get_unique_constraints.<locals>.<listcomp>{s]������
��'�'��!��-�-�=�=�=�=��!��=�=�=����r")rOrAr��filterrr�)
r2r�r rrtr�r=r_r@r��unique_keys�
uniques_groupr�s
`           @r#�get_unique_constraintsz$OracleDialect.get_unique_constraintsUsU�����6�6�";�U�C�C������"�%�%���V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W��3�3������v�v�l�+�+�4�
�
���2�2�O�D�D����^�^�<�<�
�
�
��&�&�z�:�f�&�M�M�
�
�
��

�

�

�

�����
'����


�

�

�
	
r"c�L�|�d��}|�||||||���\}}}}d|i}	d}
|�
|
dz
}
||	d<|jtj|
��fi|	�����}|r(tjr|�|j	��}|SdS)Nr_r`�	view_namez5SELECT text FROM all_views WHERE view_name=:view_namez AND owner = :schemar)
rOrAr�r	r�r�r�py2k�decode�encoding)r2r�r�rr�r=rtr_r@r5r�r�s            r#�get_view_definitionz!OracleDialect.get_view_definition�s����V�V�L�)�)�
�/3�/L�/L������!�
0M�0
�0
�,��F�F�G��y�)��F�����*�*�D�%�F�8��
�Z�
������
9�
9�&�
9�
9�
@�
@�
B�
B��
�	��y�
.��Y�Y�t�}�-�-���I��4r"c	�b���|�dd��}|�dd��}|�d��}��||||||���\}}}}	��|||||�d�����}
td�|
��}��fd�|D��S)	Nr�Fr=r�r_r`c��|ddkS)Nr��Cr!r�s r#r�z5OracleDialect.get_check_constraints.<locals>.<lambda>�s��Q�q�T�S�[�r"c���g|]C}�stjd|d�����|d��|dd���DS)z..+?. IS NOT NULL$rur)r�r�)rr�r')r��cons�include_allr2s  ��r#rFz7OracleDialect.get_check_constraints.<locals>.<listcomp>�sh���
�
�
���
�#%�(�+@�$�q�'�"J�"J�
��(�(��a��1�1�d�1�g�F�F�
�
�
r")rOrAr�r�)r2r�r rr�rtr�r=r_r@r��check_constraintss`   `       r#�get_check_constraintsz#OracleDialect.get_check_constraints�s������6�6�";�U�C�C������"�%�%���V�V�L�)�)�
�04�0M�0M������!�
1N�1
�1
�-��V�V�W��3�3������v�v�l�+�+�4�
�
��#�#8�#8�/�J�J��
�
�
�
�
�)�
�
�
�	
r")TFTFr�rQr@)NFr�r�)NF)Jrrrr��supports_alter�supports_unicode_statements�supports_unicode_binds�max_identifier_length�supports_simple_order_by_label�cte_follows_insert�supports_sequences�sequences_optional�postfetch_lastrowid�default_paramstyler�r~�requires_name_normalize�supports_comments�supports_default_values�supports_empty_insertr��statement_compilerr��ddl_compilerro�
type_compilerr�rr��execution_ctx_cls�reflection_optionsr|r)�Table�Index�construct_argumentsr1r�r�rAr�r�r�r�r,rrr	�_isolation_lookuprrrr"r%r(r9r
�cacherArIrVrZr]rjr�r�r�r�r�r�r�r�r�rBrCs@r#r�r�s���������D��N�"'��"����%*�"��������� ���H�!�M�"����#��!��'��$�L�&�M�'�H�.��5��"��
�O�!&�T�u�M�M�	
�
��U��>�>�?�����!�#�0�
7�7�7�7� 
"�
"�
"�
"�
"�,�,�,�*�L�L��X�L��P�P��X�P��N�N��X�N��%�%��X�%��N�N��X�N�

�
�
����.	
�	
�	
�	
�	
�*�>�:��F�F�F�$�$�$�F�F�F�*�*�*�*�*�*�*�*�
�
�
����=.�=.�=.�=.�~��
���
%;�%;�%;���%;�N��?�?���?�
��?�?�?���?�*��?�?���?�&��?�?�?���?���/�/�/���/�b��i�i�i���i�V��
���
 $� $� $��� $�D��
���
c�c�c���c�J��:<�)�)�)���)�V��$G�$G�$G���$G�L��l$�l$�l$���l$�\��-1�,
�,
�,
���,
�\��
���
 � � ��� �D��?D�
�
�
���
�
�
�
�
r"r�c��eZdZdZd�ZdS)r�outer_join_columnc��||_dSrQ)r)r2rs  r#r1z_OuterJoinColumn.__init__�s
������r"N)rrrr r1r!r"r#rr�s(������(�N�����r"r)JrV�	itertoolsrrr�rrrr)r	r
r;r�enginerr
rrr^rrrrrrrrrr�setr�r�r��_Binaryr�	OracleRaw�Textr%r(rkr<r=r*�FloatrErGrI�LargeBinaryrKrMrRrO�
TypeEnginerXre�Booleanrgrbr�r~�GenericTypeCompilerror�r��DDLCompilerr��IdentifierPreparerr��DefaultExecutionContextr�r�r��
ClauseElementrr!r"r#�<module>rs���y�y�v������	�	�	�	�������������#�#�#�#�#�#�������!�!�!�!�!�!������������� � � � � � �������������#�#�#�#�#�#���������������������������������������������������������������?�@E�u�w�w�
�
���S�E�K�K�M�M���
�
�����(�
����
�	������H�M���� � � � � �w� � � �
�	�$�$�$�$�$�X�
�x�/�$�$�$�2(�(�(�(�(�x�~�(�(�(�%�%�%�%�%�H�N�%�%�%�$�$�$�$�$�8�>�$�$�$������H� ���������8�=����J�J�J�J�J�8��J�J�J�"!�!�!�!�!�x�"�!�!�!�@�����H����������X�%����
��n���x���t�����������D���U�	�
�D��
�f�
��D���U���D���U������	���h��
�3���U�� �(�!�"�D�#�$#� �'���
�.z�z�z�z�z��5�z�z�z�zK
�K
�K
�K
�K
�X�)�K
�K
�K
�\
O�O�O�O�O��,�O�O�O�d
�
�
�
�
�x�:�
�
�
�.
�
�
�
�
�W�<�
�
�
�~
�~
�~
�~
�~
�G�*�~
�~
�~
�B�����s�(�����r"

Hacked By AnonymousFox1.0, Coded By AnonymousFox