id12dZddlmZddlZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd l mZdd l mZdd l mZddl mZdd l m Zddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZedZedZ Gdde j!Z"e"Z#Gdde j$Z%Gdd eZ&eZ'Gd!d"e j(e j)Z*Gd#d$e j+Z,Gd%d&e j+Z-Gd'd(e j+Z.Gd)d*e j/Z0Gd+d,e j$Z1Gd-d.e j2Z3Gd/d0e j4Z5Gd1d2e j4Z6Gd3d4e j7Z8e j7e8e j9e5e j2e3iZ:id ed5ed6ed7ed.e3d"e*d8ed*e0d9ede%d:ed;ede,d,e1e-e.d?Z;Gd@dAej<Z=GdBdCej>Z?GdDdEej@ZAGdFdGejBZCGdHdIejDZEGdJdKejFZGGdLdMe jHZIdS)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)excschema)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 --;r"c |j|dfi|S)Nrm_generate_numericrrs r#visit_DOUBLE_PRECISIONz)OracleTypeCompiler.visit_DOUBLE_PRECISIONs %t%e-?FF2FFFr"c |j|dfi|S)NrGrrrs r#visit_BINARY_DOUBLEz&OracleTypeCompiler.visit_BINARY_DOUBLEs%t%e_CCCCCr"c |j|dfi|S)NrIrrrs r#visit_BINARY_FLOATz%OracleTypeCompiler.visit_BINARY_FLOATs%t%e^BBrBBBr"c *d|d<|j|dfi|S)NT no_precisionrrrrs r#rxzOracleTypeCompiler.visit_FLOATs+">%t%eW;;;;;r"c |j|dfi|S)Nr*rrrs r# visit_NUMBERzOracleTypeCompiler.visit_NUMBERs%t%eX<<<<z6OracleCompiler.get_select_hint_text..ss+NN{ud d*NNNNNNr")joinitems)r2byfromss r#get_select_hint_textz#OracleCompiler.get_select_hint_textrs+xxNNgmmooNNNNNNr"c t|jdks |jtvrt jj||fi|SdS)Nrr)lenclausesrupper NO_ARG_FNSr SQLCompilerrrs r#rzOracleCompiler.function_argspecusL rz??Q  "'--//"C"C'8rHHRHH H2r"cdS)zCalled 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 |jtjr |jj }n|j}|j |j fi|dz|j |fi|zS)NTasfromr) r{use_ansirr visit_join isinstancerr FromGroupingelementrr)r2rrrs r#rzOracleCompiler.visit_joins < '24HHHH H#F8 $*j&=>> # *  TY11&11$,u////0 r"cgfd|D]'}t|tjr |(sdStjS)Nczjr6fd}tjjid|injjjfD]R}t|tj r |(t|tj r|j SdS)Nct|jtjr?j|jjrt|j|_dSt|jtjr?j|jjrt|j|_dSdSdSrQ)rrr ColumnClauseris_derived_fromr_OuterJoinColumn)rrs r# visit_binaryzVOracleCompiler._get_nonansi_join_whereclause..visit_join..visit_binarys! Z%<F*44V[5FGGF'7v{&C&C # j&=F*44V\5GHHF(8 'E'E FFFFr"r) isouterappendrcloned_traverseonclauserrrrJoinrr)rr jrrs` r#rz@OracleCompiler._get_nonansi_join_whereclause..visit_joins| . FFFFF, rHl+C t}---Y * * *a11*JqMMMM:#:;;*Jqy)))  * *r")rrrr and_)r2fromsfrrs @@r#_get_nonansi_join_whereclausez,OracleCompiler._get_nonansi_join_whereclausest * * * * * *<  A!Z_--  1  &48W% %r"c .|j|jfi|dzS)Nz(+))rcolumn)r2vcrts r#visit_outer_join_columnz&OracleCompiler.visit_outer_join_columns#t|BI,,,,u44r"c <|j|dzS)Nz.nextval)preparerformat_sequence)r2seqrts r#visit_sequencezOracleCompiler.visit_sequences},,S11J>>r"c d|zS)z+Oracle doesn't like ``FROM table AS alias``rr!)r2alias_name_texts r#get_render_as_alias_suffixz)OracleCompiler.get_render_as_alias_suffixs_$$r"c g}g}ttj|D]\}}|jrTt |t jr:t |jtr |j j stj d|j jr|j |}n|}t!jd|z|j }||j|j<|||||||d|t3|d|jt3|d|j|t3|ddt3|ddf|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_clauserkeyz RETURNING rz INTO ) enumerater_select_iterablesisupdater sa_schemaColumnserver_defaultrr{(_supports_update_returning_computed_colsr warntype_has_column_expressioncolumn_expressionr outparambindsr%rbindparam_string_truncate_bindparamr_add_to_result_mapr anon_labelr) r2stmtreturning_colscolumnsr2ircol_exprr1s r#returning_clausezOracleCompiler.returning_clauses"  ( 8 8  ' ' IAv  vy'788 v4h??  M    C{1 "!;88@@!|HqL DDDH'/DJx| $ LL%%d&>&>x&H&HII    NN4<<<NN O O O  # #&(*=>>&(*=>>FFD11FE400      dii0008;dii>N>NNNr"cdS)z_Need to determine how to get ``LIMIT``/``OFFSET`` into a ``UNION`` for Oracle. Nr!)r2selects r#_TODO_visit_compound_selectz*OracleCompiler._TODO_visit_compound_selects  r"c t t|dds|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)zLook for ``LIMIT`` and OFFSET in a select statement, and if so tries to wrap it in a subquery with ``rownum`` criterion. _oracle_visitNrFTselect_wraps_forcg|]}|Sr!r!rcs r# z/OracleCompiler.visit_select.. s)>)>)>!)>)>)>r"z/*+ FIRST_ROWS(%d) */c:g|]}|Sr!)traverse)relemadapters r#rFz/OracleCompiler.visit_select..7s4%%%37((..%%%r"z%dROWNUMora_rnc(g|]}|jdk |S)rL)r%rDs r#rFz/OracleCompiler.visit_select..Ys$GGGqQUh5F5F5F5F5Fr")$rr{r_display_froms_for_selectgetrwhererA _limit_clause_offset_clause _generater r>rEoptimize_limits_simple_int_limit prefix_with_limit _is_wrapper_for_update_argof_clone_copy_internals append_columnsql_util ClauseAdapteruse_binds_for_limits_offsetliteral_columnappend_whereclauserlabelcorresponding_columnrr visit_select) r2r>rr whereclause limit_clause offset_clause limitselect for_updaterImax_row offsetselectrJs @r#rfzOracleCompiler.visit_selects v55j *<( 066FJJx77#@@GG *#\\+66F+/F(!/L"1M'=+D.4)*))++'+$"j)>)>VX)>)>)>??  , 4-0-#."9"9/&-?##K-1 )*. '$3 )jm)!+!2!2!4!4J..000 * 33,,T2222&4V<#)-(4#v~5G"%"4TG^"D"D".(4&- &=G22*844? !(21)) !33*844}D4>L0)F#0vHHHHHr"c dSrr!)r2r>rts r#rhzOracleCompiler.limit_clausepsrr"cdS)NzSELECT 1 FROM DUAL WHERE 1!=1r!)r2rss r#visit_empty_set_exprz#OracleCompiler.visit_empty_set_exprss..r"c rdSd}|jjr2|ddfd|jjDzz }|jjr|dz }|jjr|dz }|S)Nrz FOR UPDATEz OF rc34K|]}j|fiVdSrQ)r)rrIrtr2s r#rz3OracleCompiler.for_update_clause..}sH&&-1  T((R((&&&&&&r"z NOWAITz SKIP LOCKED) is_subqueryrYrZrnowait skip_locked)r2r>rttmps` ` r#for_update_clausez OracleCompiler.for_update_clausevs      2  ! $  6DII&&&&&5;5K5N&&& C  ! (  9 C  ! - " > !C r"c td||jd||jdS)NDECODE(rz , 0, 1) = 1rrs r#visit_is_distinct_from_binaryz,OracleCompiler.visit_is_distinct_from_binaryrr"c td||jd||jdS)Nryrz , 0, 1) = 0rrs r# visit_isnot_distinct_from_binaryz/OracleCompiler.visit_isnot_distinct_from_binaryrr")%rrrrVr update_copyrrcompound_keywordsrCompoundSelectEXCEPTr1rrrrrrrrrrrrrrr"r<r?rfrhrprwrzr|rBrCs@r#rrGs )(.  " )73 >>>>>    ###:::   OOO    (&(&(&T555???%%% -O-O-O^   qIqIqIf///$          r"rc,eZdZdZdZdZdZdZdS)OracleDDLCompilerchd}|j |d|jzz }|jtjd|S)Nrz ON DELETE %szOracle does not contain native UPDATE CASCADE functionality - onupdates will not be rendered for foreign keys. Consider using deferrable=True, initially='deferred' or triggers.)ondeleteonupdater r-)r2 constraintrs r#define_constraint_cascadesz,OracleDDLCompiler.define_constraint_cascadessM   * Oj&99 9D   * I    r"cFd|j|jzS)NzCOMMENT ON TABLE %s IS '')r format_tabler)r2drops r#visit_drop_table_commentz*OracleDDLCompiler.visit_drop_table_comments(*T]-G-G L. .   r"c |j}|j}d}|jr|dz }|jddr|dz }|d|dd ||jd d d fd |j Ddz }|jdddur4|jdddur|dz }n|d|jddzz }|S)NzCREATE zUNIQUE oraclebitmapzBITMAP zINDEX T)include_schemaz ON ) use_schemaz (rc3RK|]!}j|ddV"dS)FT include_table literal_bindsN) sql_compilerr)rrr2s r#rz7OracleDDLCompiler.visit_create_index..sX!))T*r"rcompressFz COMPRESSz COMPRESS %d) r_verify_index_tableruniquedialect_options_prepared_index_namerrr expressions)r2createindexrrs` r#visit_create_indexz$OracleDDLCompiler.visit_create_indexsT   '''= <  I D   *8 4  I D   % %eD % A A A A  ! !%+$ ! ? ? ? ? II"-          *: 6e C C$X.z:dBB #)(3J? r"crg}|jd}|drF|ddd}|d|z|dr>|ddur|dn|d |dzd |S) Nr on_commit_rz ON COMMIT %srTz COMPRESSz COMPRESS FOR %sr)rreplacerrr)r2r table_optsoptson_commit_optionss r#post_create_tablez#OracleDDLCompiler.post_create_tables $X.   E $[ 1 9 9#s C C I I K K    /2CC D D D   MJ4''!!-0000!!"6$z:J"KLLLwwz"""r"cd|j|jddz}|jdurt jd|jdur|dz }|S)NzGENERATED ALWAYS AS (%s)FTrzzOracle computed columns do not support 'stored' persistence; set the 'persisted' flag to None or False for Oracle support.z VIRTUAL)rrsqltext persistedr CompileError)r2 generatedrs r#visit_computed_columnz'OracleDDLCompiler.visit_computed_columns{)D,=,E,E  U$-F- -    $ & &"P  E ) ) J D r"N)rrrrrrrrr!r"r#rrs_$   8###     r"rceZdZdeDZdeddDddgZdZfdZ xZ S) OracleIdentifierPreparerc6h|]}|Sr!)lowerrxs r# z"OracleIdentifierPreparer.s 888Aaggii888r"c,h|]}t|Sr!)str)rdigs r#rz"OracleIdentifierPreparer.s!C!C!Cs#c((!C!C!Cr"r r$c|}||jvp;|d|jvp,|jt j| S)z5Return True if the given identifier requires quoting.r)rreserved_wordsillegal_initial_characterslegal_charactersmatchr text_type)r2valuelc_values r#_bindparam_requires_quotesz3OracleIdentifierPreparer._bindparam_requires_quotess[;;== + + FQx4:: F(..t~e/D/DEEE r"c|jd}tt|||S)Nr)identlstripr0rformat_savepoint)r2 savepointrr3s r#rz)OracleIdentifierPreparer.format_savepoints@%%c**-t44EE t   r") rrrRESERVED_WORDSrrangeunionrrrrBrCs@r#rrs88888N!C!CeeArll!C!C!C!I!I c ""            r"rceZdZdZdS)OracleExecutionContextcj|d|j|zdz|S)NzSELECT z.nextval FROM DUAL)_execute_scalaridentifier_preparerr)r2rrss r# fire_sequencez$OracleExecutionContext.fire_sequencesC## &66s;; <" #     r"N)rrrrr!r"r#rrs#     r"rceZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ eZeZdZdZdZdZeZeZeZeZeZdZdZe j!ddddfe j"ddd fgZ# d/d Z$fd Z%d Z&e'dZ(e'dZ)e'dZ*e'dZ+e'dZ,dZ-dZ.fdZ/ddgZ0dZ1dZ2dZ3d0dZ4d0dZ5dZ6 d1dZ7e8j9 d2d Z:e8j9d!Z;e8j9d0d"Ze8j9d0d%Z?e8j9d0d&Z@e8j9 d2d'ZAe8j9 d2d(ZBe8j9 d3d)ZCe8j9d0d*ZDe8j9d0d+ZEe8j9 d0d,ZFe8j9 d2d-ZGe8j9 d4d.ZHxZIS)5 OracleDialectrTFnamed)oracle_resolve_synonymsN)resolve_synonymsrr)rrSYSTEMSYSAUXc ztjj|fi|||_||_||_||_||_dSrQ)r DefaultDialectr1r|rrTr`exclude_tablespaces)r2rrTr`use_nchar_for_unicoderrs r#r1zOracleDialect.__init__1sM '77777&;#  .$8!#6   r"cNtt|||jd|jdk|_|jrK|j |_|j tj d|_ dSdS)Nimplicit_returning)rF)r0r initialize__dict__rOserver_version_infor _is_oracle_8colspecscopypopr;rbr)r2 connectionr3s r#rzOracleDialect.initializeAs mT""--j999"&-"3"3 $":U"B# #    " M..00DM M  h/ 0 0 0!DMMM " "r"c.|jdkr|jS |d}n#tj$rd}YnwxYw|r; t d|dDS#|jcYSxYw|jS)N z7SELECT value FROM v$parameter WHERE name = 'compatible'c34K|]}t|VdSrQ)intrs r#rzJOracleDialect._get_effective_compat_server_version_info..\s(??SVV??????r".)rexecutescalarr DBAPIErrortuplesplit)r2rcompats r#)_get_effective_compat_server_version_infoz7OracleDialect._get_effective_compat_server_version_infoMs  #g - -+ + ''Ifhh F~   FFF   , 0??V\\#->->?????? 0////+ +s'<AA+B B c&|jo |jdkS)N) rr>s r#rzOracleDialect._is_oracle_8bs'KD,Dt,KKr"c&|jo |jdkS)N)rrr>s r#_supports_table_compressionz)OracleDialect._supports_table_compressionfs'OD,D,OOr"c&|jo |jdkS)N) rr>s r#_supports_table_compress_forz*OracleDialect._supports_table_compress_forjs'MD,D,MMr"c|j SrQ)rr>s r#rz#OracleDialect._supports_char_lengthns$$$r"c&|jo |jdkS)N)rr>s r#r,z6OracleDialect._supports_update_returning_computed_colsrs'MD,D,MMr"cdSrQr!)r2rrs r#do_release_savepointz"OracleDialect.do_release_savepointxs r"cr||dkrtjd|jddS)NrzOracle 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.)rr r-rr2rs r#_check_max_identifier_lengthz*OracleDialect._check_max_identifier_length|sU  9 9* E EJ    II,,, 0    tr"ctjtjdtjdg}t t |||S)Nz'test nvarchar2 returns'<)rcastrbr;rr0r_check_unicode_returns)r2radditional_testsr3s r#r z$OracleDialect._check_unicode_returnssa O)*DEE!"%%    ]D))@@ (   r"READ COMMITTED SERIALIZABLEc tdNz implemented by cx_Oracle dialectNotImplementedErrorrs r#get_isolation_levelz!OracleDialect.get_isolation_level!"DEEEr"cR ||S#t$rYdSxYw)Nr )rr)r2 dbapi_conns r#get_default_isolation_levelz)OracleDialect.get_default_isolation_levelsB $++J77 7"     $###s &c tdrr)r2rlevels r#set_isolation_levelz!OracleDialect.set_isolation_levelrr"c|s|j}|tjd||||}|duS)NzSSELECT table_name FROM all_tables WHERE table_name = :name AND owner = :schema_namer schema_namedefault_schema_namerr rdenormalize_namefirst)r2r table_namercursors r# has_tablezOracleDialect.has_tablesz .-F## HD  &&z22--f55 $  ||~~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_sequencesy .-F## H0   &&}55--f55$  ||~~T))r"cv||dS)NzSELECT USER FROM DUAL)normalize_namerrrs r#_get_default_schema_namez&OracleDialect._get_default_schema_names8""   6 7 7 > > @ @   r"cxd}g}i}|r|d||d<|r|d||d<|r|d||d<|d|z }|jtj|fi|}|r6|} | r| d | d | d | dfSd S|} t| d krtdt| d kr&| d} | d | d | d | dfSd S)zsearch 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 = :tnametnamez AND r  table_ownerdb_linkNNNNrzGThere are multiple tables visible to the schema, you must specify ownerr) rrrr rrfetchallrAssertionError) r2rr+desired_synonym desired_tableqrparamsresultrowrowss r#_resolve_synonymzOracleDialect._resolve_synonyms  4   5 NN9 : : :%4F> "  4 NN3 4 4 4&3F? #  , NN0 1 1 1+F7O W\\' " ""##CHQKK::6::  .,,..C . % & N' .-??$$D4yy1}}$)Ta1g % & N' .-r"rc 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)r9rrr rr) r2rr rrdblinkrt actual_nameownersynonyms r#_prepare_reflection_argsz&OracleDialect._prepare_reflection_args s  I262G2G"33F;; $ 5 5j A A3H33 /K 3I /K <// ;;K  N %%O &E 6\FF N))&*LD4LMMEUFLb'::r"c Nd}||}fd|DS)Nz0SELECT username FROM all_users ORDER BY usernamecFg|]}|dSrr'rr7r2s r#rFz2OracleDialect.get_schema_names..9+>>>##CF++>>>r")r)r2rrtsr!s` r#get_schema_nameszOracleDialect.get_schema_names5s5 >##A&&>>>>v>>>>r"c ,|pj}|j}d}jr*|dddjDzz }|dz }|t j||}fd|DS)N(SELECT table_name FROM all_tables WHERE 6nvl(tablespace_name, 'no tablespace') NOT IN (%s) AND rcg|]}d|zSz'%s'r!rtss r#rFz1OracleDialect.get_table_names..HMMMbfrkMMMr"z8OWNER = :owner AND IOT_NAME IS NULL AND DURATION IS NULLr?cFg|]}|dSrDrErFs r#rFz1OracleDialect.get_table_names..OrGr"rrrrrr r)r2rrrtsql_strr!s` r#get_table_nameszOracleDialect.get_table_names;s&&v'I1IJJ >-F<  #  #99MMD4LMMMNNP G  L ##CHW$5$5V#DD>>>>v>>>>r"c j}d}jr*|dddjDzz }|dz }|t j||}fd|DS)NrKrLrcg|]}d|zSrNr!rOs r#rFz6OracleDialect.get_temp_table_names..ZrQr"z.crGr"rT)r2rrtrrUr!s` r#get_temp_table_namesz"OracleDialect.get_temp_table_namesQs&&t'?@@<  #  #99MMD4LMMMNNP G  '  ##CHW$5$5V#DD>>>>v>>>>r"c |pj}tjd}|||}fd|DS)Nz4SELECT view_name FROM all_views WHERE owner = :ownerrRcFg|]}|dSrDrErFs r#rFz0OracleDialect.get_view_names..jrGr")rrr rr)r2rrrtrHr!s` r#get_view_nameszOracleDialect.get_view_namesesn&&v'I1IJJ HK L L##AT-B-B6-J-J#KK>>>>v>>>>r"c i}|dd}|dd}|d}|||||||\}}}} d|i} dg} |jr| d|jr| d d } | || d <| d z } | |d | dz} |jtj| fi| } tdd}| }|r3d|vr/||j drd |vr |j |d<nd|d<|S)NrFr=r info_cacher_r  compression compress_forzKSELECT %(columns)s FROM ALL_TABLES%(dblink)s WHERE table_name = :table_namer?z AND owner = :owner r)r=r9TDISABLEDENABLEDoracle_compress) rOrArrrrrr rdictrrarb)r2rr rrtoptionsrr=r_r@r5r9rr6enabledr7s r#get_table_optionszOracleDialect.get_table_optionsls66";UCC"%%VVL)) 040M0M     ! 1N1 1 -VVW +.  + * NN= ) ) )  , + NN> * * * -  $F7O * *DDIIg4F4FGGG##CHTNN==f==t444llnn  6## COU(K(K#!S((141AG-..15G-.r"c |dd}|dd}|d}|||||||\}}}}g} |jrd} nd} d |i} d } | || d <| d z } | dz } | || dz} |jt j| fi| } | D]}||d}|d}|d}|d}|d}|d}|ddk}|d}|d}|d}|dkr(||dkrt}nt||}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 rFr=rr_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_colrrrrYr*r)r(rkrrzWITH TIME ZONETrz\(\d+\)zDid not recognize type 'z ' of column ''YES)rauto)rr.nullabler autoincrementcommentquotecomputed)rOrArrr rr'rr*r ischema_namesrresubKeyErrorr r-r;NULLTYPErgrr)r2rr rrtrr=r_r@r9ror5rrEr7colname orig_colnamecoltyperr,r-ryr r{rr}cdicts r# get_columnszOracleDialect.get_columnss66";UCC"%%VVL)) 040M0M     ! 1N1 1 -VVW  % ,+OO+O +    $F7O . .D ))OLLL J sx~~ 8 8 8 86 "6 "C))#a&11Gq6L!fGVFAIFE1v}H!fG!fGAI(""$!%iiGG$Y66GGG##''FFF9$,0099&AA!W,,#T222&R990"09GG000II"77GGG-'/GGG 0E!!000 $"!'" E!!##|33!%g#$,j! NN5 ! ! ! !s2 G1G43G4c |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)rOrArrr rr) r2rr rrr=rtr_r@ COMMENT_SQLrEs r#get_table_commentzOracleDialect.get_table_comment sVVL)) 040M0M     ! 1N1 1 -VVW .-F    H[ ! !jf    ##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<|jdvr d |dd<||jd r|j|dd<||js3|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=)rr=r_FT) NONUNIQUEUNIQUErcz SYS_NC\d+\$r)r column_namesrr)BITMAPzFUNCTION-BASED BITMAPr oracle_bitmaprfr)rOrAr rrget_pk_constraintrgrcompile IGNORECASEr' index_namer uniqueness index_typera prefix_lengthr column_name)r2rr rrr=rtr_r@indexesr5rr4rplast_index_name pk_constraintrrioracle_sys_colrrsetindex_name_normalizeds r# get_indexeszOracleDialect.get_indexes-sVVL)) 040M0M     ! 1N1 1 -VVW + 0   %F8  2 2D ::x(( HTNN Z  , ,V , ,..   -vvl++ /  E$777 t444NBMBB$ .$ .D$($7$7$H$H ! )]6-BBB/11.!#$& u%%%(nnT_eDDE(O"EEE<@'(9{{4+U33 '&'(% "''(899 n%,,''(899#oOOr"c d|i}d}| ||d<|dz }|dz }|d|iz}|jtj|fi|}|} | S)Nr aSELECT 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=)rr rr0) r2rr rr=rtr5rrconstraint_datas r#_get_constraint_dataz"OracleDialect._get_constraint_datas  + > &  $F7O - -D  : x(( Z  9 9& 9 9++--r"c |dd}|dd}|d}||||||\}}}}g} d} |||||d} | D]i} | ddtfd | dd Dz\} }}}}}|d kr,| | } | |j| | d S) NrFr=rr_r`rrc:g|]}|Sr!rErrr2s r#rFz3OracleDialect.get_pk_constraint..'!K!K!KQ$"5"5a"8"8!K!K!Kr"rsP)constrained_columnsr)rOrArrr'r)r2rr rrtrr=r_r@pkeysconstraint_namerr7 cons_name cons_type local_column remote_table remote_column remote_owners` r#rzOracleDialect.get_pk_constraintsW66";UCC"%%VVL)) 040M0M     ! 1N1 1 -VVW33    vvl++ 4  # + +CAaC5!K!K!K!K#ac(!K!K!KLLL C"*&*&9&9)&D&DO \***',oFFFr"c |}|dd}|dd}|d}||||||\}}}} |||||d} d} tj| } | D]r} | dd t fd | d d Dz\}}}}}}|}|d kr|tjdd|izp| |}||d<|d|d}}|ds|ro| | |\}}}}|r*|}|}||d<| ||kr||d<| ddkr| d|dd<| || |tt| S)rlrFr=rr_r`cdgddgidS)N)rrreferred_schemareferred_tablereferred_columnsrhr!r!r"r#fkey_recz0OracleDialect.get_foreign_keys..fkey_recs#')#'"&$&  r"rrc:g|]}|Sr!rErs r#rFz2OracleDialect.get_foreign_keys..rr"rsRNzqGot 'None' querying 'table_name' from all_cons_columns%(dblink)s - does the user have proper rights to the table?rrrr)r+r3rrz NO ACTIONrhr) rOrArr defaultdictrr'r-r9rrlistvalues)r2rr rrtrequested_schemarr=r_r@rrfkeysr7rrrrrrrec local_cols remote_colsref_remote_nameref_remote_owner ref_dblink ref_synonyms` r#get_foreign_keyszOracleDialect.get_foreign_keyss"66";UCC"%%VVL)) 040M0M     ! 1N1 1 -VVW33    vvl++ 4      **"> 2> 2CAaC5!K!K!K!K#ac(!K!K!KLLL ++I66IC'I:$V, -I&'F -.*+( +,<' !11&*.*?*? *M*M*.*?*? *M*M2 +,&' '+/+>+>{+K+KL+/+>+> 0,,L-9C())400>>&HH1=-.1v,,58VIz2!!,///""=111ELLNN###r"c  |dd}|dd}|d}||||||\}}}}|||||d} td| } t | d} d ||| D fd fd | DDS) NrFr=rr_r`c|ddkS)NrUr!rs r#z6OracleDialect.get_unique_constraints..nsqts{r"c|dSr:r!rs r#rz6OracleDialect.get_unique_constraints..os qtr"ch|] }|d S)rr!)rixs r#rz7OracleDialect.get_unique_constraints..qs,    vJ   r"rc.g|]\}}|||vr|nddS)N)rrduplicates_indexr!)rrcols index_namess r#rFz8OracleDialect.get_unique_constraints..usM    d  $,0K,?,?DDT      r"cng|]1}|dfd|dDg2S)rcFg|]}|dS)rrErs r#rFzCOracleDialect.get_unique_constraints...~s+===1T((1..===r"rrE)rr:r2s r#rFz8OracleDialect.get_unique_constraints..{s] ''!--====!===r")rOrArfilterrr) r2rr rrtrr=r_r@r unique_keys uniques_grouprs ` @r#get_unique_constraintsz$OracleDialect.get_unique_constraintsUsU66";UCC"%%VVL)) 040M0M     ! 1N1 1 -VVW33    vvl++ 4  22ODD  ^^<<   &&z:f&MM         '     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) rOrArr rrr py2kdecodeencoding) r2rrrrr=rtr_r@r5rrs r#get_view_definitionz!OracleDialect.get_view_definitionsVVL)) /3/L/L     ! 0M0 0 ,FFGy)F   * *D%F8  Z  9 9& 9 9 @ @ B B  y .YYt}--I4r"c b|dd}|dd}|d}||||||\}}}} |||||d} td| } fd| DS) NrFr=rr_r`c|ddkS)NrCr!rs r#rz5OracleDialect.get_check_constraints..sQqTS[r"cg|]C}stjd|d|d|ddDS)z..+?. IS NOT NULL$rur)rr)rrr')rcons include_allr2s r#rFz7OracleDialect.get_check_constraints..sh    #%(+@$q'"J"J ((a11d1g F F   r")rOrArr) r2rr rrrtrr=r_r@rcheck_constraintss ` ` r#get_check_constraintsz#OracleDialect.get_check_constraintss66";UCC"%%VVL)) 040M0M     ! 1N1 1 -VVW33    vvl++ 4  ##8#8/JJ     )    r")TFTFrrQr@)NFrr)NF)Jrrrrsupports_altersupports_unicode_statementssupports_unicode_bindsmax_identifier_lengthsupports_simple_order_by_labelcte_follows_insertsupports_sequencessequences_optionalpostfetch_lastrowiddefault_paramstylerr~requires_name_normalizesupports_commentssupports_default_valuessupports_empty_insertrstatement_compilerr ddl_compilerro type_compilerrrrexecution_ctx_clsreflection_optionsr|r)TableIndexconstruct_argumentsr1rrrArrrrr,rrr _isolation_lookuprrrr"r%r(r9r cacherArIrVrZr]rjrrrrrrrrrrBrCs@r#rrs DN"'"%*" H!M"#!'$L&M'H.5" O!&Tu M M  U>>? !#0 7777 " " " " ",,,*LLXLPPXPNNXN%%X%NNXN    .      *>:FFF$$$FFF * * * * * * * *    =.=.=.=.~  %;%;%;%;N??? ????*???&???? ////biiiiV  $ $ $ $D  ccccJ:<))))V$G$G$G$GLl$l$l$l$\-1, , , , \     D?D        r"rceZdZdZdZdS)r outer_join_columnc||_dSrQ)r)r2rs r#r1z_OuterJoinColumn.__init__s  r"N)rrrr r1r!r"r#r r s((Nr"r )JrV itertoolsrrrrrrr)r r r;r enginer r rrr^rrrrrrrrrrsetrrr_Binaryr OracleRawTextr%r(rkr<r=r*FloatrErGrI LargeBinaryrKrMrRrO TypeEnginerXreBooleanrgrbrr~GenericTypeCompilerrorr DDLCompilerrIdentifierPreparerrDefaultExecutionContextrrr ClauseElementr r!r"r#rsyyv ######!!!!!! ######?@Euww  SEKKMM (   HM     w     $$$$$X x/$$$2(((((x~(((%%%%%HN%%%$$$$$8>$$$H 8=JJJJJ8 JJJ"!!!!!x"!!!@H X%  n x t   D U   D   f  D U D U h 3 U (!" D#$# ' .zzzzz5zzzzK K K K K X)K K K \ OOOOO,OOOd     x:   .     W<   ~ ~ ~ ~ ~ G*~ ~ ~ Bs(r"