
    ,h<                    @   S SK Jr  S SKJr  S SKrS SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S S	KJ
r
  S
SKJr  SSKJr  \R                  (       a6  S
SKJr  S
SKJr  S
SKJr  S
SKJr  S
SKJr  SSKJr  SSKJr  SSKJr  SSKJr   " S S5      r        SS jr g)    )annotations)
attrgetterN)Any)Callable)cast)Optional)Type)Union   )url   )util)Engine)_CoreAnyExecuteParams)CoreExecuteOptionsParameter)Dialect)URL)
Executable)InvokeDDLBase)HasSchemaAttr)	Visitablec                      \ rS rSr% SS jr\" \\" S 5      5      rS\	S'   \" \\" \
" S5      5      5      rS\	S'   \" \\" S	 5      5      rS
\	S'   SS jrSS jrSS jr        SS jr  S       SS jjrSrg)MockConnection#   dialectr   c                    Xl         X l        g N_dialect_execute_impl)selfr   executes      N/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/engine/mock.py__init__MockConnection.__init__$   s    $    c                    U $ r    ss    r#   <lambda>MockConnection.<lambda>(   s    !r&   r   enginer   c                .    U R                   R                  $ r   )r   namer)   s    r#   r+   r,   *   s    QZZ__r&   strr/   c                    U $ r   r(   )r!   kwargss     r#   connectMockConnection.connect,       r&   c                    UR                   $ r   )schema)r!   objs     r#   schema_for_object MockConnection.schema_for_object/   s    zzr&   c                    U $ r   r(   )r!   kws     r#   execution_options MockConnection.execution_options2   r5   r&   c                V    SUS'   U" SU R                   U S.UD6R                  U5        g )NF
checkfirst)r   
connectionr(   )r   traverse_single)r!   visitorcallableelementr2   s       r#   _run_ddl_visitorMockConnection._run_ddl_visitor5   s6      %| 	
LLT	
5;	

/'
"r&   Nc                $    U R                  X5      $ r   )r    )r!   r8   
parametersr=   s       r#   r"   MockConnection.execute@   s     !!#22r&   r   )r   r   r"   zCallable[..., Any])r2   r   returnr   )r8   r   rJ   zOptional[str])r<   r   rJ   r   )rC   zType[InvokeDDLBase]rD   r   r2   r   rJ   None)NN)r8   r   rH   zOptional[_CoreAnyExecuteParams]r=   z%Optional[CoreExecuteOptionsParameter]rJ   r   )__name__
__module____qualname____firstlineno__r$   r   r   propertyr-   __annotations__r   r   r/   r3   r9   r=   rE   r"   __static_attributes__r(   r&   r#   r   r   #   s    % #x45FF5C*Z*@!ABGWBS(#<=>D#>	#,	# 	# 		#
 
	# 7;CG	33 43 A	3
 
3 3r&   r   c                    [         R                  " U 5      nUR                  5       n0 n[        R                  " U5       H  nXb;   d  M
  UR                  U5      XV'   M     U" S0 UD6n[        Xq5      $ )a  Create a "mock" engine used for echoing DDL.

This is a utility function used for debugging or storing the output of DDL
sequences as generated by :meth:`_schema.MetaData.create_all`
and related methods.

The function accepts a URL which is used only to determine the kind of
dialect to be used, as well as an "executor" callable function which
will receive a SQL expression object and parameters, which can then be
echoed or otherwise printed.   The executor's return value is not handled,
nor does the engine allow regular string statements to be invoked, and
is therefore only useful for DDL that is sent to the database without
receiving any results.

E.g.::

    from sqlalchemy import create_mock_engine


    def dump(sql, *multiparams, **params):
        print(sql.compile(dialect=engine.dialect))


    engine = create_mock_engine("postgresql+psycopg2://", dump)
    metadata.create_all(engine, checkfirst=False)

:param url: A string URL which typically needs to contain only the
 database backend name.

:param executor: a callable which receives the arguments ``sql``,
 ``*multiparams`` and ``**params``.  The ``sql`` parameter is typically
 an instance of :class:`.ExecutableDDLElement`, which can then be compiled
 into a string using :meth:`.ExecutableDDLElement.compile`.

.. versionadded:: 1.4 - the :func:`.create_mock_engine` function replaces
   the previous "mock" engine strategy used with
   :func:`_sa.create_engine`.

.. seealso::

    :ref:`faq_ddl_as_string`

r(   )_urlmake_urlget_dialectr   get_cls_kwargspopr   )r   executorr<   udialect_clsdialect_argskr   s           r#   create_mock_enginer^   I   sf    ` 	cA--/KL  -7 ffQiLO .
 )L)G',,r&   )r   zUnion[str, URL]rY   r   r<   r   rJ   r   )!
__future__r   operatorr   typingr   r   r   r   r	   r
    r   rT   r   TYPE_CHECKINGbaser   
interfacesr   r   r   r   sql.baser   sql.ddlr   
sql.schemar   sql.visitorsr   r   r^   r(   r&   r#   <module>rj      s~    #           
17#%'*(#3 #3L=-	=-$'=-/2=-=-r&   