# APSW Module

The module is the main interface to SQLite. Methods and data on the module have process wide effects.

## Type Annotations

Comprehensive `type annotations` are included, and your code can be checked by your editor or tools like mypy. You can refer to the types below for your annotations (eg as `apsw.SQLiteValue`)

Your source files should include this line, which can be omitted in Python 3.14 onwards:

    from __future__ import annotations

Note

These types are not available at run time, and have no effect when your code is running. They are only referenced when running a type checker, or using an IDE.

You will require a recent version of Python to use the type annotations.

class apsw.SQLiteValue
  `None`​ | `int`​ | `float`​ | `Buffer`​ | `str`​

  SQLite supports 5 types - `None`​ (NULL), 64 bit signed `int`​, 64 bit `float`​, `bytes`​ (`Buffer`​), and `str`​ (unicode text)

class apsw.SQLiteValues
  `tuple`​[`SQLiteValue`​, …]

  A sequence of zero or more `SQLiteValue`​

class apsw.PyObjectBinding

  Result of `pyobject()`

class apsw.CArrayBinding

  Result of `carray()`

class apsw.Binding
  `SQLiteValue`​ | `zeroblob`​ | `PyObjectBinding`​ | `CArrayBinding`​

  An individual binding can be any of the `SQLiteValues`​. `zeroblob`​, `pyobject()`, or `carray()`

class apsw.Bindings
  `Sequence`​[`Binding`​] | `Mapping`​[`str`​, `Binding`​]

  Query bindings are either a sequence of `Binding`​, or a `dict`​ mapping string names to a `Binding`​. You can use `dict`​ subclasses or any type registered with `collections.abc.Mapping` for named bindings

class apsw.AggregateClass

  (`Protocol`​) Represents a running aggregate function

      def step(self, *values: SQLiteValue) -> None:
          """Called with value(s) from a matching row"""
          ...

      def final(self) -> SQLiteValue:
          """Called after all matching rows have been processed to get the final value"""
          ...

class apsw.AggregateT
  `Any`​

  An object provided as first parameter of step and final aggregate functions

class apsw.AggregateStep
  `Callable`​[[`AggregateT`​, * `SQLiteValues`​], `None`​]

  `AggregateStep`​ is called on each matching row with the relevant number of `SQLiteValue`​

class apsw.AggregateFinal
  `Callable`​[[`AggregateT`​], `SQLiteValue`​]

  Final is called after all matching rows have been processed by step, and returns a `SQLiteValue`​

class apsw.AggregateFactory
  `Callable`​[[], `AggregateClass`​ | `tuple`​[`AggregateT`​, `AggregateStep`​, `AggregateFinal`​]]

  Called each time for the start of a new calculation using an aggregate function, returning an object, a step function and a final function

class apsw.ScalarProtocol
  `Callable`​[[* `SQLiteValues`​], `SQLiteValue`​]

  Scalar callbacks take zero or more `SQLiteValues`​, and return a `SQLiteValue`​

class apsw.WindowClass

  (`Protocol`​) Represents a running window function

      def step(self, param: SQLiteValue) -> None:
          """Adds the param(s) to the window"""
          ...

      def final(self) -> SQLiteValue:
          """Finishes the function and returns final value"""
          ...

      def value(self) -> SQLiteValue:
          """Returns the current value"""
          ...

      def inverse(self, param: SQLiteValue) -> None:
          """Removes the param(s) from the window"""
          ...

class apsw.WindowT
  `Any`​

  An object provided as first parameter of the 4 window functions, if not using class based callbacks

class apsw.WindowStep
  `Callable`​[[`WindowT`​, * `SQLiteValues`​], `None`​]

  Window function step takes zero or more `SQLiteValues`​

class apsw.WindowFinal
  `Callable`​[[`WindowT`​, * `SQLiteValues`​], `SQLiteValue`​]

  Window function final takes zero or more `SQLiteValues`​, and returns a `SQLiteValue`​

class apsw.WindowValue
  `Callable`​[[`WindowT`​], `SQLiteValue`​]

  Window function value returns the current `SQLiteValue`​

class apsw.WindowInverse
  `Callable`​[[`WindowT`​, * `SQLiteValues`​], `None`​]

  Window function inverse takes zero or more `SQLiteValues`​

class apsw.WindowFactory
  `Callable`​[[], `WindowClass`​ | `tuple`​[`WindowT`​, `WindowStep`​, `WindowFinal`​, `WindowValue`​, `WindowInverse`​]]

  Called each time at the start of a new window function execution. It should return either an object with relevant methods or an object used as the first parameter and the 4 methods

class apsw.RowTracer
  `Callable`​[[`Cursor`​, `SQLiteValues`​], `Any`​]

  Row tracers are called with the `Cursor`​, and the row that would be returned. If you return `None`​, then no row is returned, otherwise whatever is returned is returned as a result row for the query

class apsw.ExecTracer
  `Callable`​[[`Cursor`​, `str`​, `Optional`​[`Bindings`​]], `bool`​]

  Execution tracers are called with the cursor, sql query text, and the bindings used. Return False/`None`​ to abort execution, or True to continue

class apsw.ConvertBinding
  `Callable`​[[`Cursor`​, `int`​, `Any`​], `SQLiteValue`​]

  Called with a cursor, parameter number, and value to convert into a supported SQLite value. Note that parameter numbers begin at 1. This is a good location to call `jsonb_encode()` to convert values to JSON representation

class apsw.ConvertJSONB
  `Callable`​[[`Cursor`​, `int`​, `bytes`​], `Any`​]

  Called with a cursor, column number, and a `bytes`​ that is valid JSONB. This is a good location to call `jsonb_decode()` to convert JSON representation into any Python value

class apsw.Authorizer
  `Callable`​[[`int`​, `Optional`​[`str`​], `Optional`​[`str`​], `Optional`​[`str`​], `Optional`​[`str`​]], `int`​]

  Authorizers are called with an operation code and 4 strings (which could be `None`​) depending on the operatation. Return SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE

class apsw.CommitHook
  `Callable`​[[], `bool`​]

  Commit hook is called with no arguments and should return True to abort the commit and False to let it continue

class apsw.PreupdateHook
  `Callable`​[[PreUpdate], `None`​]

  The hook is called with information about the update, and has no return value

class apsw.TokenizerResult
  `Iterable`​[`str`​ | `tuple`​[`str`​, …] | `tuple`​[`int`​, `int`​, * `tuple`​[`str`​, …]]]

  The return from a tokenizer is based on the include_offsets and include_colocated parameters you provided, both defaulting to `True`. See `FTS5Tokenizer.__call__()` for examples.

class apsw.Tokenizer
  `Callable`​[[`bytes`​, `int`​, `str`​ | `None`​], `TokenizerResult`​]

  The tokenizer is called with UTF8 encoded `bytes`​, `int`​ flags, and a locale.

class apsw.FTS5TokenizerFactory
  `Callable`​[[`Connection`​, `list`​[`str`​]], `Tokenizer`​]

  The factory is called with a `list`​ of strings as an argument and should return a suitably configured `Tokenizer`​

class apsw.FTS5Function
  `Callable`​[[`FTS5ExtensionApi`​, * `SQLiteValues`​], `SQLiteValue`​]

  The first argument is the extension API while the rest are the function parameters from the SQL

class apsw.FTS5QueryPhrase
  `Callable`​[[`FTS5ExtensionApi`​, `Any`​], `None`​]

  Callback from `FTS5ExtensionApi.query_phrase()`

class apsw.SessionStreamInput
  `Callable`​[[`int`​], `Buffer`​]

  Streaming input function that is called with a number of `bytes`​ requested returning up to that many `bytes`​, and zero length for end of file

class apsw.ChangesetInput
  `SessionStreamInput`​ | `Buffer`​

  Changeset input can either be a streaming callback or data

class apsw.SessionStreamOutput
  `Callable`​[[`memoryview`​], `None`​]

  Streaming output callable is called with each block of streaming data

class apsw.JSONBTypes
  `str`​
  | `bool`​
  | `None`​
  | `int`​
  | `float`​
  | `list`​[`JSONBTypes`​]
  | `tuple`​[`JSONBTypes`​]
  | `Mapping`​[`str`​ | `None`​ | `int`​ | `float`​ | `bool`​, `JSONBTypes`​]

  Used by `apsw.jsonb_encode()`. `Mapping`​ (`dict`​) keys must be `str`​ in JSONB. Like the builtin JSON module, `None`​/`int`​/`float`​/`bool`​ keys will be stringized.

## API Reference

apsw.SQLITE_VERSION_NUMBER: int

  The integer version number of SQLite that APSW was compiled against. For example SQLite 3.44.1 will have the value 3440100. This number may be different than the actual library in use if the library is shared and has been updated. Call `sqlite_lib_version()` to get the actual library version.

apsw.allow_missing_dict_bindings(value: bool) → bool

  Changes how missing bindings are handled when using a `dict`. Historically missing bindings were treated as None. It was anticipated that dict bindings would be used when there were lots of columns, so having missing ones defaulting to None was convenient.

  Unfortunately this also has the side effect of not catching typos and similar issues.

  APSW 3.41.0.0 changed the default so that missing dict entries will result in an exception. Call this with True to restore the earlier behaviour, and False to have an exception.

  The previous value is returned.

apsw.apsw_version() → str

  Returns the APSW version.

apsw.carray(object: Buffer | tuple[str, ...] | tuple[Buffer, ...], *, start: int = 0, stop: int = -1, flags: int = -1) → CArrayBinding

  Indicates a Python object is being provided as a runtime array for the Carray extension. This is to provide bulk numbers (int or float), strings, or blobs to a query, The array will be used without calling back into Python code or acquiring the GIL. It takes about 5% of the CPU time using Carray versus passing each value in one at a time via Python.

  See the example.

  Parameters:

    - object –

      For numbers, any object that implements the buffer protocol as a single contiguous binary data like `bytes`, `bytearray`, `array.array`, numpy.array etc.

      Otherwise it should be a tuple of strings, or a tuple of binary data objects. All elements must be the same type.

    - start – Index of the first entry to bind

    - stop – Index to stop at - ie one beyond the last entry bound. Default is all remaining members.

    - flags –

      Default auto detect.

      For numbers, detection is done from the buffer format code and itemsize. You can use `format` and `itemsize` attributes of `memoryview(object)` to see what they are.

      Format `i`, `l`, `q`

        `SQLITE_CARRAY_INT32` or `SQLITE_CARRAY_INT64` based on itemsize

      Format `d`

        `SQLITE_CARRAY_DOUBLE`

      You can explicitly provide the type such as `apsw.SQLITE_CARRAY_INT32`. If it is incorrect then the values will be nonsense.

      If using a tuple of string or blobs, you can specify `apsw.SQLITE_CARRAY_TEXT` and `apsw.SQLITE_CARRAY_BLOB` respectively, but they would be detected anyway. A wrong value will fail.

  Note

  Carray support is only present if APSW was compiled with `SQLITE_ENABLE_CARRAY` such as PyPi builds. The array must have at least one member and at most 2 billion.

apsw.compile_options: tuple[str, ...]

  A tuple of the options used to compile SQLite. For example it will be something like this, but with around 50 entries:

      ('ENABLE_LOCKING_STYLE=0', 'TEMP_STORE=1', 'THREADSAFE=1', 'ENABLE_FTS5',
       'OMIT_SHARED_CACHE', 'SYSTEM_MALLOC')

  Calls: sqlite3_compileoption_get

apsw.complete(statement: str) → bool

  Returns True if the input string comprises one or more complete SQL statements by looking for an unquoted trailing semi-colon. It does not consider comments or blank lines to be complete.

  An example use would be if you were prompting the user for SQL statements and needed to know if you had a whole statement, or needed to ask for another line:

      statement = input("SQL> ")
      while not apsw.complete(statement):
         more = input("  .. ")
         statement = statement + "\\n" + more

  Calls: sqlite3_complete

apsw.config(op: int, *args: Any) → None
  Parameters:

    - op – A configuration operation

    - args – Zero or more arguments as appropriate for op

  Some operations don’t make sense from a Python program. All the remaining are supported.

  Calls: sqlite3_config

apsw.connection_hooks: list[Callable[[Connection], None]]

  The purpose of the hooks is to allow the easy registration of `functions`, virtual tables or similar items with each `Connection` as it is created. The default value is an empty list. Whenever a Connection is created, each item in apsw.connection_hooks is invoked with a single parameter being the new Connection object. If the hook raises an exception then the creation of the Connection fails.

apsw.connections() → list[Connection]

  Returns a list of the connections

apsw.enable_shared_cache(enable: bool) → None

  Discouraged.

  Calls: sqlite3_enable_shared_cache

apsw.exception_for(code: int) → Exception

  If you would like to raise an exception that corresponds to a particular SQLite error code then call this function. It also understands extended error codes.

  For example to raise SQLITE_IOERR_ACCESS:

      raise apsw.exception_for(apsw.SQLITE_IOERR_ACCESS)

apsw.fork_checker() → None

  Note This method is not available on Windows as it does not support the fork system call.

  SQLite does not allow the use of database connections across forked processes (see the SQLite FAQ Q6). (Forking creates a child process that is a duplicate of the parent including the state of all data structures in the program. If you do this to SQLite then parent and child would both consider themselves owners of open databases and silently corrupt each other’s work and interfere with each other’s locks.)

  One example of how you may end up using fork is if you use the `multiprocessing module` which can use fork to make child processes.

  If you do use fork or multiprocessing on a platform that supports fork then you must ensure database connections and their objects (cursors, backup, blobs etc) are not used in the parent process, or are all closed before calling fork or starting a Process. (Note you must call close to ensure the underlying SQLite objects are closed. It is also a good idea to call `gc.collect(2)` to ensure anything you may have missed is also deallocated.)

  Once you run this method, extra checking code is inserted into SQLite’s mutex operations (at a very small performance penalty) that verifies objects are not used across processes. You will get a `ForkingViolationError` if you do so. Note that due to the way Python’s internals work, the exception will be delivered to `sys.excepthook()` in addition to the normal exception mechanisms and may be reported by Python after the line where the issue actually arose. (Destructors of objects you didn’t close also run between lines.)

  You should only call this method as the first line after importing APSW, as it has to shutdown and re-initialize SQLite. If you have any SQLite objects already allocated when calling the method then the program will later crash. The recommended use is to use the fork checking as part of your test suite.

apsw.format_sql_value(value: SQLiteValue) → str

  Returns a Python string representing the supplied value in SQLite syntax.

  Note that SQLite represents floating point Nan as `NULL`, infinity as `9e999` and loses the sign on negative zero.

apsw.hard_heap_limit(limit: int) → int

  Enforces SQLite keeping memory usage below limit bytes and returns the previous limit.

  See also

  `soft_heap_limit()`

  Calls: sqlite3_hard_heap_limit64

apsw.initialize() → None

  It is unlikely you will want to call this method as SQLite automatically initializes.

  Calls: sqlite3_initialize

apsw.keywords: set[str]

  A set containing every SQLite keyword

  Calls:

    - sqlite3_keyword_count

    - sqlite3_keyword_name

apsw.log(errorcode: int, message: str) → None

  Calls the SQLite logging interface. You must format the message before passing it to this method:

      apsw.log(apsw.SQLITE_NOMEM, f"Need { needed } bytes of memory")

  Calls: sqlite3_log

apsw.memory_high_water(reset: bool = False) → int

  Returns the maximum amount of memory SQLite has used. If reset is True then the high water mark is reset to the current value.

  See also

  `status()`

  Calls: sqlite3_memory_highwater

apsw.memory_used() → int

  Returns the amount of memory SQLite is currently using.

  See also

  `status()`

  Calls: sqlite3_memory_used

apsw.no_change: object

  A sentinel value used to indicate no change in a value when used with `VTCursor.ColumnNoChange()`, `VTTable.UpdateChangeRow()`, `TableChange.new`, and `PreUpdate.update`.

apsw.pyobject(object: Any) → PyObjectBinding

  Indicates a Python object is being provided as a runtime value.

apsw.randomness(amount: int) → bytes

  Gets random data from SQLite’s random number generator.

  Parameters:

    amount – How many bytes to return

  Calls: sqlite3_randomness

apsw.release_memory(amount: int) → int

  Requests SQLite try to free amount bytes of memory. Returns how many bytes were freed.

  Calls: sqlite3_release_memory

apsw.set_default_vfs(name: str) → None

  Sets the default vfs to name which must be an existing vfs. See `vfs_names()`.

  Calls:

    - sqlite3_vfs_register

    - sqlite3_vfs_find

apsw.shutdown() → None

  It is unlikely you will want to call this method and there is no need to do so. It is a really bad idea to call it unless you are absolutely sure all `connections`, `blobs`, `cursors`, `vfs` etc have been closed, deleted and garbage collected.

  Calls: sqlite3_shutdown

apsw.sleep(milliseconds: int) → int

  Sleep for at least the number of milliseconds, returning how many milliseconds were requested from the operating system.

  Calls: sqlite3_sleep

apsw.soft_heap_limit(limit: int) → int

  Requests SQLite try to keep memory usage below limit bytes and returns the previous limit.

  See also

  `hard_heap_limit()`

  Calls: sqlite3_soft_heap_limit64

apsw.sqlite3_sourceid() → str

  Returns the exact checkin information for the SQLite 3 source being used.

  Calls: sqlite3_sourceid

apsw.sqlite_lib_version() → str

  Returns the version of the SQLite library. This value is queried at run time from the library so if you use shared libraries it will be the version in the shared library.

  Calls: sqlite3_libversion

apsw.status(op: int, reset: bool = False) → tuple[int, int]

  Returns current and highwater measurements.

  Parameters:

    - op – A status parameter

    - reset – If True then the highwater is set to the current value

  Returns:

    A tuple of current value and highwater value

  See also

  - `Connection.status()` for statistics about a `Connection`

  - Status example

  Calls: sqlite3_status64

apsw.strglob(glob: str, string: str) → int

  Does string GLOB matching. Zero is returned on a match.

  Calls: sqlite3_strglob

apsw.stricmp(string1: str, string2: str) → int

  Does string case-insensitive comparison. Zero is returned on a match.

  Calls: sqlite3_stricmp

apsw.strlike(glob: str, string: str, escape: int = 0) → int

  Does string LIKE matching. Zero is returned on a match.

  Calls: sqlite3_strlike

apsw.strnicmp(string1: str, string2: str, count: int) → int

  Does string case-insensitive comparison. Zero is returned on a match.

  Calls: sqlite3_strnicmp

apsw.unregister_vfs(name: str) → None

  Unregisters the named vfs. See `vfs_names()`.

  Calls:

    - sqlite3_vfs_unregister

    - sqlite3_vfs_find

apsw.using_amalgamation: bool

  If True then SQLite amalgamation is in use (statically compiled into APSW). Using the amalgamation means that SQLite shared libraries are not used and will not affect your code.

apsw.vfs_details() → list[dict[str, int | str]]

Returns a list with details of each vfs. The detail is a dictionary with the keys being the names of the sqlite3_vfs data structure, and their corresponding values.

Pointers are converted using `PyLong_FromVoidPtr()`.

Calls: sqlite3_vfs_find

apsw.vfs_names() → list[str]

  Returns a list of the currently installed vfs. The first item in the list is the default vfs.

  Calls: sqlite3_vfs_find

## SQLite constants

SQLite has many constants used in various interfaces. To use a constant such as SQLITE_OK, just use `apsw.SQLITE_OK`.

The same values can be used in different contexts. For example SQLITE_OK and SQLITE_CREATE_INDEX both have a value of zero. For each group of constants there is also a mapping (dict) available that you can supply a string to and get the corresponding numeric value, or supply a numeric value and get the corresponding string. These can help improve diagnostics/logging, calling other modules etc. For example:

    apsw.mapping_authorizer_function["SQLITE_READ"] == 20
    apsw.mapping_authorizer_function[20] == "SQLITE_READ"

apsw.mapping_access: dict[str | int, int | str]

  Flags for the xAccess VFS method constants

  SQLITE_ACCESS_EXISTS, SQLITE_ACCESS_READ, SQLITE_ACCESS_READWRITE

apsw.mapping_authorizer_function: dict[str | int, int | str]

  Authorizer Action Codes constants

  SQLITE_ALTER_TABLE, SQLITE_ANALYZE, SQLITE_ATTACH, SQLITE_COPY, SQLITE_CREATE_INDEX, SQLITE_CREATE_TABLE, SQLITE_CREATE_TEMP_INDEX, SQLITE_CREATE_TEMP_TABLE, SQLITE_CREATE_TEMP_TRIGGER, SQLITE_CREATE_TEMP_VIEW, SQLITE_CREATE_TRIGGER, SQLITE_CREATE_VIEW, SQLITE_CREATE_VTABLE, SQLITE_DELETE, SQLITE_DETACH, SQLITE_DROP_INDEX, SQLITE_DROP_TABLE, SQLITE_DROP_TEMP_INDEX, SQLITE_DROP_TEMP_TABLE, SQLITE_DROP_TEMP_TRIGGER, SQLITE_DROP_TEMP_VIEW, SQLITE_DROP_TRIGGER, SQLITE_DROP_VIEW, SQLITE_DROP_VTABLE, SQLITE_FUNCTION, SQLITE_INSERT, SQLITE_PRAGMA, SQLITE_READ, SQLITE_RECURSIVE, SQLITE_REINDEX, SQLITE_SAVEPOINT, SQLITE_SELECT, SQLITE_TRANSACTION, SQLITE_UPDATE

apsw.mapping_authorizer_return_codes: dict[str | int, int | str]

  Authorizer Return Codes constants

  SQLITE_DENY, SQLITE_IGNORE, SQLITE_OK

apsw.mapping_bestindex_constraints: dict[str | int, int | str]

  Virtual Table Constraint Operator Codes constants

  SQLITE_INDEX_CONSTRAINT_EQ, SQLITE_INDEX_CONSTRAINT_FUNCTION, SQLITE_INDEX_CONSTRAINT_GE, SQLITE_INDEX_CONSTRAINT_GLOB, SQLITE_INDEX_CONSTRAINT_GT, SQLITE_INDEX_CONSTRAINT_IS, SQLITE_INDEX_CONSTRAINT_ISNOT, SQLITE_INDEX_CONSTRAINT_ISNOTNULL, SQLITE_INDEX_CONSTRAINT_ISNULL, SQLITE_INDEX_CONSTRAINT_LE, SQLITE_INDEX_CONSTRAINT_LIKE, SQLITE_INDEX_CONSTRAINT_LIMIT, SQLITE_INDEX_CONSTRAINT_LT, SQLITE_INDEX_CONSTRAINT_MATCH, SQLITE_INDEX_CONSTRAINT_NE, SQLITE_INDEX_CONSTRAINT_OFFSET, SQLITE_INDEX_CONSTRAINT_REGEXP

apsw.mapping_carray: dict[str | int, int | str]

  Datatypes for the CARRAY table-valued function constants

  SQLITE_CARRAY_BLOB, SQLITE_CARRAY_DOUBLE, SQLITE_CARRAY_INT32, SQLITE_CARRAY_INT64, SQLITE_CARRAY_TEXT

apsw.mapping_config: dict[str | int, int | str]

  Configuration Options constants

  SQLITE_CONFIG_COVERING_INDEX_SCAN, SQLITE_CONFIG_GETMALLOC, SQLITE_CONFIG_GETMUTEX, SQLITE_CONFIG_GETPCACHE, SQLITE_CONFIG_GETPCACHE2, SQLITE_CONFIG_HEAP, SQLITE_CONFIG_LOG, SQLITE_CONFIG_LOOKASIDE, SQLITE_CONFIG_MALLOC, SQLITE_CONFIG_MEMDB_MAXSIZE, SQLITE_CONFIG_MEMSTATUS, SQLITE_CONFIG_MMAP_SIZE, SQLITE_CONFIG_MULTITHREAD, SQLITE_CONFIG_MUTEX, SQLITE_CONFIG_PAGECACHE, SQLITE_CONFIG_PCACHE, SQLITE_CONFIG_PCACHE2, SQLITE_CONFIG_PCACHE_HDRSZ, SQLITE_CONFIG_PMASZ, SQLITE_CONFIG_SCRATCH, SQLITE_CONFIG_SERIALIZED, SQLITE_CONFIG_SINGLETHREAD, SQLITE_CONFIG_SMALL_MALLOC, SQLITE_CONFIG_SORTERREF_SIZE, SQLITE_CONFIG_SQLLOG, SQLITE_CONFIG_STMTJRNL_SPILL, SQLITE_CONFIG_URI, SQLITE_CONFIG_WIN32_HEAPSIZE

apsw.mapping_conflict_resolution_modes: dict[str | int, int | str]

  Conflict resolution modes constants

  SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE, SQLITE_ROLLBACK

apsw.mapping_db_config: dict[str | int, int | str]

  Database Connection Configuration Options constants

  SQLITE_DBCONFIG_DEFENSIVE, SQLITE_DBCONFIG_DQS_DDL, SQLITE_DBCONFIG_DQS_DML, SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE, SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE, SQLITE_DBCONFIG_ENABLE_COMMENTS, SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_DBCONFIG_ENABLE_VIEW, SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_DBCONFIG_LOOKASIDE, SQLITE_DBCONFIG_MAINDBNAME, SQLITE_DBCONFIG_MAX, SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_DBCONFIG_RESET_DATABASE, SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_DBCONFIG_TRIGGER_EQP, SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_DBCONFIG_WRITABLE_SCHEMA

apsw.mapping_db_status: dict[str | int, int | str]

  Status Parameters for database connections constants

  SQLITE_DBSTATUS_CACHE_HIT, SQLITE_DBSTATUS_CACHE_MISS, SQLITE_DBSTATUS_CACHE_SPILL, SQLITE_DBSTATUS_CACHE_USED, SQLITE_DBSTATUS_CACHE_USED_SHARED, SQLITE_DBSTATUS_CACHE_WRITE, SQLITE_DBSTATUS_DEFERRED_FKS, SQLITE_DBSTATUS_LOOKASIDE_HIT, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, SQLITE_DBSTATUS_LOOKASIDE_USED, SQLITE_DBSTATUS_MAX, SQLITE_DBSTATUS_SCHEMA_USED, SQLITE_DBSTATUS_STMT_USED, SQLITE_DBSTATUS_TEMPBUF_SPILL

apsw.mapping_device_characteristics: dict[str | int, int | str]

  Device Characteristics constants

  SQLITE_IOCAP_ATOMIC, SQLITE_IOCAP_ATOMIC16K, SQLITE_IOCAP_ATOMIC1K, SQLITE_IOCAP_ATOMIC2K, SQLITE_IOCAP_ATOMIC32K, SQLITE_IOCAP_ATOMIC4K, SQLITE_IOCAP_ATOMIC512, SQLITE_IOCAP_ATOMIC64K, SQLITE_IOCAP_ATOMIC8K, SQLITE_IOCAP_BATCH_ATOMIC, SQLITE_IOCAP_IMMUTABLE, SQLITE_IOCAP_POWERSAFE_OVERWRITE, SQLITE_IOCAP_SAFE_APPEND, SQLITE_IOCAP_SEQUENTIAL, SQLITE_IOCAP_SUBPAGE_READ, SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN

apsw.mapping_extended_result_codes: dict[str | int, int | str]

  Extended Result Codes constants

  SQLITE_ABORT_ROLLBACK, SQLITE_AUTH_USER, SQLITE_BUSY_RECOVERY, SQLITE_BUSY_SNAPSHOT, SQLITE_BUSY_TIMEOUT, SQLITE_CANTOPEN_CONVPATH, SQLITE_CANTOPEN_DIRTYWAL, SQLITE_CANTOPEN_FULLPATH, SQLITE_CANTOPEN_ISDIR, SQLITE_CANTOPEN_NOTEMPDIR, SQLITE_CANTOPEN_SYMLINK, SQLITE_CONSTRAINT_CHECK, SQLITE_CONSTRAINT_COMMITHOOK, SQLITE_CONSTRAINT_DATATYPE, SQLITE_CONSTRAINT_FOREIGNKEY, SQLITE_CONSTRAINT_FUNCTION, SQLITE_CONSTRAINT_NOTNULL, SQLITE_CONSTRAINT_PINNED, SQLITE_CONSTRAINT_PRIMARYKEY, SQLITE_CONSTRAINT_ROWID, SQLITE_CONSTRAINT_TRIGGER, SQLITE_CONSTRAINT_UNIQUE, SQLITE_CONSTRAINT_VTAB, SQLITE_CORRUPT_INDEX, SQLITE_CORRUPT_SEQUENCE, SQLITE_CORRUPT_VTAB, SQLITE_ERROR_KEY, SQLITE_ERROR_MISSING_COLLSEQ, SQLITE_ERROR_RESERVESIZE, SQLITE_ERROR_RETRY, SQLITE_ERROR_SNAPSHOT, SQLITE_ERROR_UNABLE, SQLITE_IOERR_ACCESS, SQLITE_IOERR_AUTH, SQLITE_IOERR_BADKEY, SQLITE_IOERR_BEGIN_ATOMIC, SQLITE_IOERR_BLOCKED, SQLITE_IOERR_CHECKRESERVEDLOCK, SQLITE_IOERR_CLOSE, SQLITE_IOERR_CODEC, SQLITE_IOERR_COMMIT_ATOMIC, SQLITE_IOERR_CONVPATH, SQLITE_IOERR_CORRUPTFS, SQLITE_IOERR_DATA, SQLITE_IOERR_DELETE, SQLITE_IOERR_DELETE_NOENT, SQLITE_IOERR_DIR_CLOSE, SQLITE_IOERR_DIR_FSYNC, SQLITE_IOERR_FSTAT, SQLITE_IOERR_FSYNC, SQLITE_IOERR_GETTEMPPATH, SQLITE_IOERR_IN_PAGE, SQLITE_IOERR_LOCK, SQLITE_IOERR_MMAP, SQLITE_IOERR_NOMEM, SQLITE_IOERR_RDLOCK, SQLITE_IOERR_READ, SQLITE_IOERR_ROLLBACK_ATOMIC, SQLITE_IOERR_SEEK, SQLITE_IOERR_SHMLOCK, SQLITE_IOERR_SHMMAP, SQLITE_IOERR_SHMOPEN, SQLITE_IOERR_SHMSIZE, SQLITE_IOERR_SHORT_READ, SQLITE_IOERR_TRUNCATE, SQLITE_IOERR_UNLOCK, SQLITE_IOERR_VNODE, SQLITE_IOERR_WRITE, SQLITE_LOCKED_SHAREDCACHE, SQLITE_LOCKED_VTAB, SQLITE_NOTICE_RBU, SQLITE_NOTICE_RECOVER_ROLLBACK, SQLITE_NOTICE_RECOVER_WAL, SQLITE_OK_LOAD_PERMANENTLY, SQLITE_OK_SYMLINK, SQLITE_READONLY_CANTINIT, SQLITE_READONLY_CANTLOCK, SQLITE_READONLY_DBMOVED, SQLITE_READONLY_DIRECTORY, SQLITE_READONLY_RECOVERY, SQLITE_READONLY_ROLLBACK, SQLITE_WARNING_AUTOINDEX

apsw.mapping_file_control: dict[str | int, int | str]

  Standard File Control Opcodes constants

  SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, SQLITE_FCNTL_BLOCK_ON_CONNECT, SQLITE_FCNTL_BUSYHANDLER, SQLITE_FCNTL_CHUNK_SIZE, SQLITE_FCNTL_CKPT_DONE, SQLITE_FCNTL_CKPT_START, SQLITE_FCNTL_CKSM_FILE, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, SQLITE_FCNTL_COMMIT_PHASETWO, SQLITE_FCNTL_DATA_VERSION, SQLITE_FCNTL_EXTERNAL_READER, SQLITE_FCNTL_FILESTAT, SQLITE_FCNTL_FILE_POINTER, SQLITE_FCNTL_GET_LOCKPROXYFILE, SQLITE_FCNTL_HAS_MOVED, SQLITE_FCNTL_JOURNAL_POINTER, SQLITE_FCNTL_LAST_ERRNO, SQLITE_FCNTL_LOCKSTATE, SQLITE_FCNTL_LOCK_TIMEOUT, SQLITE_FCNTL_MMAP_SIZE, SQLITE_FCNTL_NULL_IO, SQLITE_FCNTL_OVERWRITE, SQLITE_FCNTL_PDB, SQLITE_FCNTL_PERSIST_WAL, SQLITE_FCNTL_POWERSAFE_OVERWRITE, SQLITE_FCNTL_PRAGMA, SQLITE_FCNTL_RBU, SQLITE_FCNTL_RESERVE_BYTES, SQLITE_FCNTL_RESET_CACHE, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, SQLITE_FCNTL_SET_LOCKPROXYFILE, SQLITE_FCNTL_SIZE_HINT, SQLITE_FCNTL_SIZE_LIMIT, SQLITE_FCNTL_SYNC, SQLITE_FCNTL_SYNC_OMITTED, SQLITE_FCNTL_TEMPFILENAME, SQLITE_FCNTL_TRACE, SQLITE_FCNTL_VFSNAME, SQLITE_FCNTL_VFS_POINTER, SQLITE_FCNTL_WAL_BLOCK, SQLITE_FCNTL_WIN32_AV_RETRY, SQLITE_FCNTL_WIN32_GET_HANDLE, SQLITE_FCNTL_WIN32_SET_HANDLE, SQLITE_FCNTL_ZIPVFS

apsw.mapping_fts5_token_flags: dict[str | int, int | str]

  FTS5 Token Flag constants

  FTS5_TOKEN_COLOCATED

apsw.mapping_fts5_tokenize_reason: dict[str | int, int | str]

  FTS5 Tokenize Reason constants

  FTS5_TOKENIZE_AUX, FTS5_TOKENIZE_DOCUMENT, FTS5_TOKENIZE_PREFIX, FTS5_TOKENIZE_QUERY

apsw.mapping_function_flags: dict[str | int, int | str]

  Function Flags constants

  SQLITE_DETERMINISTIC, SQLITE_DIRECTONLY, SQLITE_INNOCUOUS, SQLITE_RESULT_SUBTYPE, SQLITE_SELFORDER1, SQLITE_SUBTYPE

apsw.mapping_limits: dict[str | int, int | str]

  Run-Time Limit Categories constants

  SQLITE_LIMIT_ATTACHED, SQLITE_LIMIT_COLUMN, SQLITE_LIMIT_COMPOUND_SELECT, SQLITE_LIMIT_EXPR_DEPTH, SQLITE_LIMIT_FUNCTION_ARG, SQLITE_LIMIT_LENGTH, SQLITE_LIMIT_LIKE_PATTERN_LENGTH, SQLITE_LIMIT_SQL_LENGTH, SQLITE_LIMIT_TRIGGER_DEPTH, SQLITE_LIMIT_VARIABLE_NUMBER, SQLITE_LIMIT_VDBE_OP, SQLITE_LIMIT_WORKER_THREADS

apsw.mapping_locking_level: dict[str | int, int | str]

  File Locking Levels constants

  SQLITE_LOCK_EXCLUSIVE, SQLITE_LOCK_NONE, SQLITE_LOCK_PENDING, SQLITE_LOCK_RESERVED, SQLITE_LOCK_SHARED

apsw.mapping_open_flags: dict[str | int, int | str]

  Flags For File Open Operations constants

  SQLITE_OPEN_AUTOPROXY, SQLITE_OPEN_CREATE, SQLITE_OPEN_DELETEONCLOSE, SQLITE_OPEN_EXCLUSIVE, SQLITE_OPEN_EXRESCODE, SQLITE_OPEN_FULLMUTEX, SQLITE_OPEN_MAIN_DB, SQLITE_OPEN_MAIN_JOURNAL, SQLITE_OPEN_MEMORY, SQLITE_OPEN_NOFOLLOW, SQLITE_OPEN_NOMUTEX, SQLITE_OPEN_PRIVATECACHE, SQLITE_OPEN_READONLY, SQLITE_OPEN_READWRITE, SQLITE_OPEN_SHAREDCACHE, SQLITE_OPEN_SUBJOURNAL, SQLITE_OPEN_SUPER_JOURNAL, SQLITE_OPEN_TEMP_DB, SQLITE_OPEN_TEMP_JOURNAL, SQLITE_OPEN_TRANSIENT_DB, SQLITE_OPEN_URI, SQLITE_OPEN_WAL

apsw.mapping_prepare_flags: dict[str | int, int | str]

  Prepare Flags constants

  SQLITE_PREPARE_DONT_LOG, SQLITE_PREPARE_NORMALIZE, SQLITE_PREPARE_NO_VTAB, SQLITE_PREPARE_PERSISTENT

apsw.mapping_result_codes: dict[str | int, int | str]

  Result Codes constants

  SQLITE_ABORT, SQLITE_AUTH, SQLITE_BUSY, SQLITE_CANTOPEN, SQLITE_CONSTRAINT, SQLITE_CORRUPT, SQLITE_DONE, SQLITE_EMPTY, SQLITE_ERROR, SQLITE_FORMAT, SQLITE_FULL, SQLITE_INTERNAL, SQLITE_INTERRUPT, SQLITE_IOERR, SQLITE_LOCKED, SQLITE_MISMATCH, SQLITE_MISUSE, SQLITE_NOLFS, SQLITE_NOMEM, SQLITE_NOTADB, SQLITE_NOTFOUND, SQLITE_NOTICE, SQLITE_OK, SQLITE_PERM, SQLITE_PROTOCOL, SQLITE_RANGE, SQLITE_READONLY, SQLITE_ROW, SQLITE_SCHEMA, SQLITE_TOOBIG, SQLITE_WARNING

apsw.mapping_session_changeset_apply_v2_flags: dict[str | int, int | str]

  Flags for sqlite3changeset_apply_v2 constants

  (Only present when session extension is enabled)

  SQLITE_CHANGESETAPPLY_FKNOACTION, SQLITE_CHANGESETAPPLY_IGNORENOOP, SQLITE_CHANGESETAPPLY_INVERT, SQLITE_CHANGESETAPPLY_NOSAVEPOINT

apsw.mapping_session_changeset_start_v2_flags: dict[str | int, int | str]

  Flags for sqlite3changeset_start_v2 constants

  (Only present when session extension is enabled)

  SQLITE_CHANGESETSTART_INVERT

apsw.mapping_session_config_options: dict[str | int, int | str]

  Values for sqlite3session_config constants

  (Only present when session extension is enabled)

  SQLITE_SESSION_CONFIG_STRMSIZE

apsw.mapping_session_conflict: dict[str | int, int | str]

  Constants Passed To The Conflict Handler constants

  (Only present when session extension is enabled)

  SQLITE_CHANGESET_CONFLICT, SQLITE_CHANGESET_CONSTRAINT, SQLITE_CHANGESET_DATA, SQLITE_CHANGESET_FOREIGN_KEY, SQLITE_CHANGESET_NOTFOUND

apsw.mapping_session_conflict_response: dict[str | int, int | str]

  Constants Returned By The Conflict Handler constants

  (Only present when session extension is enabled)

  SQLITE_CHANGESET_ABORT, SQLITE_CHANGESET_OMIT, SQLITE_CHANGESET_REPLACE

apsw.mapping_session_object_config_options: dict[str | int, int | str]

  Options for sqlite3session_object_config constants

  (Only present when session extension is enabled)

  SQLITE_SESSION_OBJCONFIG_ROWID, SQLITE_SESSION_OBJCONFIG_SIZE

apsw.mapping_setlk_timeout_flags: dict[str | int, int | str]

  Flags for sqlite3_setlk_timeout() constants

  SQLITE_SETLK_BLOCK_ON_CONNECT

apsw.mapping_statement_status: dict[str | int, int | str]

  Status Parameters for prepared statements constants

  SQLITE_STMTSTATUS_AUTOINDEX, SQLITE_STMTSTATUS_FILTER_HIT, SQLITE_STMTSTATUS_FILTER_MISS, SQLITE_STMTSTATUS_FULLSCAN_STEP, SQLITE_STMTSTATUS_MEMUSED, SQLITE_STMTSTATUS_REPREPARE, SQLITE_STMTSTATUS_RUN, SQLITE_STMTSTATUS_SORT, SQLITE_STMTSTATUS_VM_STEP

apsw.mapping_status: dict[str | int, int | str]

  Status Parameters constants

  SQLITE_STATUS_MALLOC_COUNT, SQLITE_STATUS_MALLOC_SIZE, SQLITE_STATUS_MEMORY_USED, SQLITE_STATUS_PAGECACHE_OVERFLOW, SQLITE_STATUS_PAGECACHE_SIZE, SQLITE_STATUS_PAGECACHE_USED, SQLITE_STATUS_PARSER_STACK, SQLITE_STATUS_SCRATCH_OVERFLOW, SQLITE_STATUS_SCRATCH_SIZE, SQLITE_STATUS_SCRATCH_USED

apsw.mapping_sync: dict[str | int, int | str]

  Synchronization Type Flags constants

  SQLITE_SYNC_DATAONLY, SQLITE_SYNC_FULL, SQLITE_SYNC_NORMAL

apsw.mapping_trace_codes: dict[str | int, int | str]

  SQL Trace Event Codes constants

  SQLITE_TRACE_CLOSE, SQLITE_TRACE_PROFILE, SQLITE_TRACE_ROW, SQLITE_TRACE_STMT

apsw.mapping_txn_state: dict[str | int, int | str]

  Allowed return values from sqlite3_txn_state() constants

  SQLITE_TXN_NONE, SQLITE_TXN_READ, SQLITE_TXN_WRITE

apsw.mapping_virtual_table_configuration_options: dict[str | int, int | str]

  Virtual Table Configuration Options constants

  SQLITE_VTAB_CONSTRAINT_SUPPORT, SQLITE_VTAB_DIRECTONLY, SQLITE_VTAB_INNOCUOUS, SQLITE_VTAB_USES_ALL_SCHEMAS

apsw.mapping_virtual_table_scan_flags: dict[str | int, int | str]

  Virtual Table Scan Flags constants

  SQLITE_INDEX_SCAN_HEX, SQLITE_INDEX_SCAN_UNIQUE

apsw.mapping_wal_checkpoint: dict[str | int, int | str]

  Checkpoint Mode Values constants

  SQLITE_CHECKPOINT_FULL, SQLITE_CHECKPOINT_NOOP, SQLITE_CHECKPOINT_PASSIVE, SQLITE_CHECKPOINT_RESTART, SQLITE_CHECKPOINT_TRUNCATE

apsw.mapping_xshmlock_flags: dict[str | int, int | str]

  Flags for the xShmLock VFS method constants

  SQLITE_SHM_EXCLUSIVE, SQLITE_SHM_LOCK, SQLITE_SHM_SHARED, SQLITE_SHM_UNLOCK