+
    Xj                        R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^RI
Ht ^R	IHt ^R
IHt ]'       d%   ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt R R lt ! R R]4      t]tR# )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.

)annotations)Any)Dict)Optional)Type)TYPE_CHECKING)Union)MySQLDialect_mysqldb)langhelpers)Literal)ConnectArgsType)DBAPIConnection)DBAPICursor)DBAPIModule)PoolProxiedConnection)URLc                    V ^8  d   QhRRRR/# )   connection_clsz	Type[Any]returnbool )formats   "}   /Users/wind/Downloads/Coruna-main学习资料A/backend/venv/lib/python3.14/site-packages/sqlalchemy/dialects/mysql/pymysql.py__annotate__r   J   s     
 
Y 
4 
    c                   \         P                  ! V P                  4      p VP                  ^,          pVR8H  ;'       d/    VP                  '       * ;'       g    VP                  ^ ,          RJ#   \
         d     R# i ; i)aT  Given a Connection class like pymysql.Connection, aiomysql.Connection,
asyncmy.Connection, inspect the ping() method and determine if it
has a "reconnect" parameter that either defaults to True, or is positional.

a return value of True here means that when we call ``connection.ping()``,
we **must** pass `reconnect=False`.  a return value of False means that
we should call ``connection.ping()`` with **no arguments**.

This routine originates from issue #10492 for pymysql, however arg
signature mismatches in aiomysql/asyncmy tracked by issue #13306
necessitated a more open ended function.

	reconnectF)r
   get_callable_argspecpingargsdefaults
IndexError)r   inspreconnect_args   &  r    _connection_ping_reconnects_truer%   J   sy     ++N,?,?@D
		! + 
 
>>q!1!>	
  s   A0 0A?>A?c                     a  ] tR t^ctRtRtRt]P                  R R l4       t	]
R R l4       t]P                  R R	 l4       tR
 R ltRR V 3R llltR V 3R lltR R ltRtV ;t# )MySQLDialect_pymysqlpymysqlTNc                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   !MySQLDialect_pymysql.__annotate__j   s      d r   c                	     \        R 4      P                  pVP                  V n        R#   \        \
        3 d     R# i ; i)zpymysql.cursorsTF)
__import__cursorsSSCursor	_sscursorImportErrorAttributeError)selfr.   s   & r   supports_server_side_cursors1MySQLDialect_pymysql.supports_server_side_cursorsi   s?    	 !23;;G$--DN^, 		s   &* ??c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r+   s   s     % %[ %r   c                	    \        R 4      # )r(   )r-   )clss   &r   import_dbapi!MySQLDialect_pymysql.import_dbapir   s    )$$r   c                   V ^8  d   QhRR/# r*   r   )r   s   "r   r   r+   w   s     @ @T @r   c                     \        R4      P                  P                  p\        V4      #   \        \
        3 d     R# i ; i)a  determine if pymysql has deprecated, changed the default of,
or removed the 'reconnect' argument of connection.ping().

See #10492 and
https://github.com/PyMySQL/mysqlclient/discussions/651#discussioncomment-7308971
for background.

Revised as part of #13306

zpymysql.connectionsT)r-   connections
Connectionr%   r1   r2   )r3   r>   s   & r   _send_false_to_ping(MySQLDialect_pymysql._send_false_to_pingv   sG    	@#%k**  4J?? ^, 		s   , A Ac                    V ^8  d   QhRRRR/# )r   dbapi_connectionr   r   zLiteral[True]r   )r   s   "r   r   r+      s       M r   c                	p    V P                   '       d   VP                  R 4       R# VP                  4        R# )FT)r?   r   )r3   rB   s   &&r   do_pingMySQLDialect_pymysql.do_ping   s2    ###!!%(  !!#r   c               $    V ^8  d   QhRRRRRR/# )r   urlr   _translate_argszOptional[Dict[str, Any]]r   r   r   )r   s   "r   r   r+      s$     
 

)A
	
r   c                	D   < Vf   \        RR7      p\        SV `	  WR7      # )Nuser)username)rH   )dictsupercreate_connect_args)r3   rG   rH   	__class__s   &&&r   rN   (MySQLDialect_pymysql.create_connect_args   s/     ""F3Ow* + 
 	
r   c               (    V ^8  d   QhRRRRRRRR/# )	r   ezDBAPIModule.Error
connectionz7Optional[Union[PoolProxiedConnection, DBAPIConnection]]cursorzOptional[DBAPICursor]r   r   r   )r   s   "r   r   r+      s3       L &	
 
r   c                	   < \         SV `  WV4      '       d   R # \        WP                  P                  4      '       d,   \        V4      P                  4       pRV9   ;'       g    RV9   # R# )Tzalready closedzconnection was killedF)rM   is_disconnect
isinstanceloaded_dbapiErrorstrlower)r3   rR   rS   rT   str_erO   s   &&&& r   rV   "MySQLDialect_pymysql.is_disconnect   s`     7 77,,2233FLLNE E)MM-D-M r   c                    V ^8  d   QhRRRR/# )r   	exceptionBaseExceptionr   r   r   )r   s   "r   r   r+      s     ! !] !s !r   c                	    \        VP                  ^ ,          \        4      '       d   VP                  ^ ,          pVP                  ^ ,          # )    )rW   r    	Exception)r3   r_   s   &&r   _extract_error_code(MySQLDialect_pymysql._extract_error_code   s5    innQ'33!q)I~~a  r   )r0   )N)__name__
__module____qualname____firstlineno__driversupports_statement_cachedescription_encodingr
   memoized_propertyr4   classmethodr9   r?   rD   rN   rV   rd   __static_attributes____classcell__)rO   s   @r   r'   r'   c   s    F#"" # % % ""@ #@*
 
  ! !r   r'   N)__doc__
__future__r   typingr   r   r   r   r   r   mysqldbr	   utilr
   util.typingr   engine.interfacesr   r   r   r   r   
engine.urlr   r%   r'   dialectr   r   r   <module>rz      s\   )V #        )  "4400:!
2M!/ M!` r   