zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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å ã@s4dZddlmZddlmZGdd„deƒZeZdS)aÛ
 
.. dialect:: mysql+pymysql
    :name: PyMySQL
    :dbapi: pymysql
    :connectstring: mysql+pymysql://<username>:<password>@<host>/<dbname>[?<options>]
    :url: https://pymysql.readthedocs.io/
 
Unicode
-------
 
Please see :ref:`mysql_unicode` for current recommendations on unicode
handling.
 
.. _pymysql_ssl:
 
SSL Connections
------------------
 
The PyMySQL DBAPI accepts the same SSL arguments as that of MySQLdb,
described at :ref:`mysqldb_ssl`.   See that section for additional examples.
 
If the server uses an automatically-generated certificate that is self-signed
or does not match the host name (as seen from the client), it may also be
necessary to indicate ``ssl_check_hostname=false`` in PyMySQL::
 
    connection_uri = (
        "mysql+pymysql://scott:tiger@192.168.0.134/test"
        "?ssl_ca=/home/gord/client-ssl/ca.pem"
        "&ssl_cert=/home/gord/client-ssl/client-cert.pem"
        "&ssl_key=/home/gord/client-ssl/client-key.pem"
        "&ssl_check_hostname=false"
    )
 
 
MySQL-Python Compatibility
--------------------------
 
The pymysql DBAPI is a pure Python port of the MySQL-python (MySQLdb) driver,
and targets 100% compatibility.   Most behavioral notes for MySQL-python apply
to the pymysql driver as well.
 
é)ÚMySQLDialect_mysqldbé)Ú langhelperscsXeZdZdZdZdZejdd„ƒZe    dd„ƒZ
d‡fdd    „    Z ‡fd
d „Z d d „Z ‡ZS)ÚMySQLDialect_pymysqlÚpymysqlTNc    Cs8ztdƒj}|j|_WdSttfk
r2YdSXdS)Nzpymysql.cursorsTF)Ú
__import__ÚcursorsZSSCursorZ    _sscursorÚ ImportErrorÚAttributeError)Úselfr©r úXd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/dialects/mysql/pymysql.pyÚsupports_server_side_cursors@s 
z1MySQLDialect_pymysql.supports_server_side_cursorscCstdƒS)Nr)r)Úclsr r r Ú import_dbapiIsz!MySQLDialect_pymysql.import_dbapics"|dkrtdd}tƒj||dS)NÚuser)Úusername)Ú_translate_args)ÚdictÚsuperÚcreate_connect_args)r Úurlr©Ú    __class__r r rMs 
ÿz(MySQLDialect_pymysql.create_connect_argscsFtƒ |||¡rdSt||jjƒr>t|ƒ ¡}d|kp<d|kSdSdS)NTzalready closedzconnection was killedF)rÚ is_disconnectÚ
isinstanceZdbapiÚErrorÚstrÚlower)r ÚeÚ
connectionÚcursorZstr_err r rTs ÿz"MySQLDialect_pymysql.is_disconnectcCs$t|jdtƒr|jd}|jdS)Né)rÚargsÚ    Exception)r Ú    exceptionr r r Ú_extract_error_code_s
z(MySQLDialect_pymysql._extract_error_code)N)Ú__name__Ú
__module__Ú __qualname__ZdriverZsupports_statement_cacheZdescription_encodingrZmemoized_propertyrÚ classmethodrrrr&Ú __classcell__r r rr r:s
 
 rN)Ú__doc__ZmysqldbrÚutilrrÚdialectr r r r Ú<module>
s,  +