semvec/pypi-packages huggingface dataset:
karellen-sqlite 0.0.3
Karellen Sqlite Extensions
License: Apache License, Version 2.0

Karellen Sqlite Extensions
==========================

|Gitter chat|

About
-----

This project contains `Karellen <https://www.karellen.co/karellen/>`__
`Sqlite <https://docs.python.org/3/library/sqlite3.html>`__ extensions
to the standard Python SQLite3 module.

These extensions are verified to work with Python 3.x (x >= 3) on Linux
x86\_64 and have been verified to work with GA and Debug builds of
CPython. Any CPython ABI-compliant Python should work as well (YMMV).

SQLite3 Update Hook
-------------------

The `SQLite3 update
hook <https://www.sqlite.org/c3ref/update_hook.html>`__ allows the hook
to be notified if the database to which the connection is made was
changed.

This a drop-in replacement that can be used as demonstrated in the
example below. The name ``pysqlite2`` was chosen to the driver to be
discovered automatically by `Django SQLite
backend <https://docs.djangoproject.com/en/1.10/ref/databases/#using-newer-versions-of-the-sqlite-db-api-2-0-driver>`__.

.. code:: python


    from pysqlite2 import connect

    def hook(conn, op, db_name, table_name, rowid):
        """Handle notification here. Do not modify the connection!"""
        
    with connect(":memory:") as conn:
        conn.set_update_hook(hook)
        conn.execute("CREATE TABLE a (int id);")
        conn.execute("INSERT INTO a VALUES (1);")

You can also use this library directly with your Python 3 without
renaming:

.. code:: python

    from sqlite3 import connect
    from karellen.sqlite3 import Connection

    with connect(":memory:", factory=Connection):
        # Do something useful here
        pass

.. |Gitter chat| image:: https://badges.gitter.im/karellen/gitter.svg
   :target: https://gitter.im/karellen/lobby