zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
U
¸ý°dð ã@s<dZddlZddlmZddlmZGdd„deƒZeZdS)    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é)ÚexccsFeZdZdZdZd ‡fdd„    Zedd„ƒZed    d
„ƒZd d „Z    ‡Z
S)ÚOracleDialect_oracledbTÚoracledbé2Nc sRtƒj||||f|Ž|jdk    rN|s.t|tƒrNt|tƒr<|ni}|jjf|ŽdS©N)ÚsuperÚ__init__ZdbapiÚ
isinstanceÚdictZinit_oracle_client)ÚselfZauto_convert_lobsZcoerce_to_decimalZ    arraysizeZencoding_errorsZ
thick_modeÚkwargsÚkw©Ú    __class__©úZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/dialects/oracle/oracledb.pyr =s
üû
ÿÿzOracleDialect_oracledb.__init__cCs ddl}|S)Nr)r)ÚclsrrrrÚ import_dbapiUsz#OracleDialect_oracledb.import_dbapicCs
|jjjSr    )Ú
connectionZdbapi_connectionZthin)rrrrrÚ is_thin_mode[sz#OracleDialect_oracledb.is_thin_modecCsbd}|dk    r:t d|j¡}|r:tdd„| ddd¡Dƒƒ}||_|jdkr^|jdkr^t d    ¡‚dS)
N)rrrz(\d+)\.(\d+)(?:\.(\d+))?css|]}|dk    rt|ƒVqdSr    )Úint)Ú.0ÚxrrrÚ    <genexpr>dsz7OracleDialect_oracledb._load_version.<locals>.<genexpr>rér)rz*oracledb version 1 and above are supported)ÚreÚmatchÚversionÚtupleÚgroupZ oracledb_verrZInvalidRequestError)rZ dbapi_moduler ÚmrrrÚ _load_version_s ÿÿz$OracleDialect_oracledb._load_version)TTrNN) Ú__name__Ú
__module__Ú __qualname__Zsupports_statement_cacheZdriverr Ú classmethodrrr$Ú __classcell__rrrrr9sú
 
r)    Ú__doc__rZ    cx_oraclerZ_OracleDialect_cx_oracleÚrrÚdialectrrrrÚ<module>s
+  5