anki.dbproxy
============

.. py:module:: anki.dbproxy


Attributes
----------

.. autoapisummary::

   anki.dbproxy.ValueFromDB
   anki.dbproxy.Row
   anki.dbproxy.ValueForDB


Classes
-------

.. autoapisummary::

   anki.dbproxy.DBProxy


Functions
---------

.. autoapisummary::

   anki.dbproxy.emulate_named_args


Module Contents
---------------

.. py:data:: ValueFromDB

.. py:data:: Row

.. py:data:: ValueForDB

.. py:class:: DBProxy(backend: anki._backend.RustBackend)

   .. py:method:: transact(op: collections.abc.Callable[[], None]) -> None

      Run the provided operation inside a transaction.

      Please note that all backend methods automatically wrap changes in a transaction,
      so there is no need to use this when calling methods like update_cards(), unless
      you are making other changes at the same time and want to ensure they are applied
      completely or not at all.

      If the operation throws an exception, the changes will be automatically rolled
      back.



   .. py:method:: all(sql: str, *args: ValueForDB, **kwargs: ValueForDB) -> list[Row]


   .. py:method:: list(sql: str, *args: ValueForDB, **kwargs: ValueForDB) -> list[ValueFromDB]


   .. py:method:: first(sql: str, *args: ValueForDB, **kwargs: ValueForDB) -> Row | None


   .. py:method:: scalar(sql: str, *args: ValueForDB, **kwargs: ValueForDB) -> ValueFromDB


   .. py:attribute:: execute


   .. py:method:: executemany(sql: str, args: collections.abc.Iterable[collections.abc.Sequence[ValueForDB]]) -> None


.. py:function:: emulate_named_args(sql: str, args: tuple, kwargs: dict[str, Any]) -> tuple[str, collections.abc.Sequence[ValueForDB]]

