o
    E6d                     @   s<   d Z ddlZddlmZ ddlmZ G d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                       sP   e Zd ZdZdZ					d fdd	Zedd Zed	d
 Zdd Z	  Z
S )OracleDialect_oracledbToracledb2   Nc                    sb   t  j||||fi | | jd ur-|st|tr/t|tr |ni }| jjdi | d S d S d S )N )super__init__Zdbapi
isinstancedictZinit_oracle_client)selfZauto_convert_lobsZcoerce_to_decimalZ	arraysizeZencoding_errorsZ
thick_modekwargskw	__class__r	   zC:\Users\jesus\OneDrive\Desktop\erpjis_fastapi\backend\jisbackend\Lib\site-packages\sqlalchemy/dialects/oracle/oracledb.pyr   =   s    	
zOracleDialect_oracledb.__init__c                 C   s   dd l }|S )Nr   )r   )clsr   r	   r	   r   import_dbapiT   s   z#OracleDialect_oracledb.import_dbapic                 C   s
   |j jjS N)
connectionZdbapi_connectionZthin)r   r   r	   r	   r   is_thin_modeZ   s   
z#OracleDialect_oracledb.is_thin_modec                 C   sf   d}|d urt d|j}|rtdd |dddD }|| _| jdk r/| jdkr1td	d S d S )
N)r   r   r   z(\d+)\.(\d+)(?:\.(\d+))?c                 s   s     | ]}|d urt |V  qd S r   )int).0xr	   r	   r   	<genexpr>c   s    z7OracleDialect_oracledb._load_version.<locals>.<genexpr>r      r   )r   z*oracledb version 1 and above are supported)rematchversiontuplegroupZoracledb_verr   ZInvalidRequestError)r   Zdbapi_moduler    mr	   r	   r   _load_version^   s   z$OracleDialect_oracledb._load_version)TTr   NN)__name__
__module____qualname__Zsupports_statement_cacheZdriverr   classmethodr   r   r$   __classcell__r	   r	   r   r   r   9   s    

r   )	__doc__r   Z	cx_oracler   Z_OracleDialect_cx_oracle r   r   dialectr	   r	   r	   r   <module>   s   +4