
    
 @g                     J    d Z ddlZddlmZ ddlmZ  G d de          ZeZdS )	a4  
.. dialect:: oracle+oracledb
    :name: python-oracledb
    :dbapi: oracledb
    :connectstring: oracle+oracledb://user:pass@hostname:port[/dbname][?service_name=<service>[&key=value&key=value...]]
    :url: https://oracle.github.io/python-oracledb/

python-oracledb is released by Oracle to supersede the cx_Oracle driver.
It is fully compatible with cx_Oracle and features both a "thin" client
mode that requires no dependencies, as well as a "thick" mode that uses
the Oracle Client Interface in the same way as cx_Oracle.

.. seealso::

    :ref:`cx_oracle` - all of cx_Oracle's notes apply to the oracledb driver
    as well.

Thick mode support
------------------

By default the ``python-oracledb`` is started in thin mode, that does not
require oracle client libraries to be installed in the system. The
``python-oracledb`` driver also support a "thick" mode, that behaves
similarly to ``cx_oracle`` and requires that Oracle Client Interface (OCI)
is installed.

To enable this mode, the user may call ``oracledb.init_oracle_client``
manually, or by passing the parameter ``thick_mode=True`` to
:func:`_sa.create_engine`. To pass custom arguments to ``init_oracle_client``,
like the ``lib_dir`` path, a dict may be passed to this parameter, as in::

    engine = sa.create_engine("oracle+oracledb://...", thick_mode={
        "lib_dir": "/path/to/oracle/client/lib", "driver_name": "my-app"
    })

.. seealso::

    https://python-oracledb.readthedocs.io/en/latest/api_manual/module.html#oracledb.init_oracle_client


.. versionadded:: 2.0.0 added support for oracledb driver.

    N   )OracleDialect_cx_oracle   )excc                   d     e Zd ZdZdZ	 	 	 	 	 d	 fd	Zed             Zed             Zd Z	 xZ
S )
OracleDialect_oracledbToracledb2   Nc                      t                      j        ||||fi | | j        D|st          |t                    r/t          |t                    r|ni } | j        j        di | d S d S d S )N )super__init__dbapi
isinstancedictinit_oracle_client)	selfauto_convert_lobscoerce_to_decimal	arraysizeencoding_errors
thick_modekwargskw	__class__s	           W/var/www/piapp/venv/lib/python3.11/site-packages/sqlalchemy/dialects/oracle/oracledb.pyr   zOracleDialect_oracledb.__init__=   s     			
 	

 	
 	
 	
 :! "$Z66 "  **d;;CB)DJ)//B/////	 "!!!    c                     dd l }|S )Nr   )r	   )clsr	   s     r   import_dbapiz#OracleDialect_oracledb.import_dbapiT   s    r   c                 $    |j         j        j        S N)
connectiondbapi_connectionthin)r   r#   s     r   is_thin_modez#OracleDialect_oracledb.is_thin_modeZ   s    $5::r   c                    d}|Jt          j        d|j                  }|r.t          d |                    ddd          D                       }|| _        | j        dk     r| j        dk    rt          j        d          d S d S )	N)r   r   r   z(\d+)\.(\d+)(?:\.(\d+))?c              3   8   K   | ]}|t          |          V  d S r"   )int).0xs     r   	<genexpr>z7OracleDialect_oracledb._load_version.<locals>.<genexpr>c   s1           CFF   r   r      r   )r   z*oracledb version 1 and above are supported)rematchversiontuplegrouporacledb_verr   InvalidRequestError)r   dbapi_moduler0   ms       r   _load_versionz$OracleDialect_oracledb._load_version^   s    #4l6JKKA     $%GGAq!$4$4        $t##(9I(E(E)<   $#(E(Er   )TTr
   NN)__name__
__module____qualname__supports_statement_cachedriverr   classmethodr    r&   r7   __classcell__)r   s   @r   r   r   9   s        #F 0 0 0 0 0 0.   [
 ; ; [;      r   r   )	__doc__r.   	cx_oracler   _OracleDialect_cx_oracle r   r   dialectr   r   r   <module>rD      sv   * *V 
			 J J J J J J      1 1 1 1 15 1 1 1h !r   