neosqlite.options module

class neosqlite.options.WriteConcern(w: int | str | None = None, wtimeout: int | None = None, j: bool | None = None, fsync: bool | None = None)[source]

Bases: object

Represents a write concern for MongoDB compatibility. Maps to SQLite synchronous PRAGMAs.

__init__(w: int | str | None = None, wtimeout: int | None = None, j: bool | None = None, fsync: bool | None = None)[source]
property document: dict[str, Any]
property acknowledged: bool
class neosqlite.options.ReadPreference(mode: int, tag_sets: list | None = None, max_staleness_ms: int | None = None, hedge: dict | None = None)[source]

Bases: object

Represents a read preference for MongoDB compatibility. (Mostly a placeholder in NeoSQLite as SQLite is single-node).

PRIMARY = 0
PRIMARY_PREFERRED = 1
SECONDARY = 2
SECONDARY_PREFERRED = 3
NEAREST = 4
__init__(mode: int, tag_sets: list | None = None, max_staleness_ms: int | None = None, hedge: dict | None = None)[source]
property mode: int
property document: dict[str, Any]
class neosqlite.options.ReadConcern(level: str | None = None)[source]

Bases: object

Represents a read concern for MongoDB compatibility.

__init__(level: str | None = None)[source]
property level: str | None
property ok_for_legacy: bool
property document: dict[str, Any]
class neosqlite.options.CodecOptions(document_class: type = <class 'dict'>, tz_aware: bool = False, uuid_representation: int = 0)[source]

Bases: object

Represents codec options for MongoDB compatibility.

__init__(document_class: type = <class 'dict'>, tz_aware: bool = False, uuid_representation: int = 0)[source]
class neosqlite.options.JournalMode[source]

Bases: object

Represents valid SQLite journal modes. Used to validate the journal_mode parameter in Connection.

DELETE = 'DELETE'
TRUNCATE = 'TRUNCATE'
PERSIST = 'PERSIST'
MEMORY = 'MEMORY'
WAL = 'WAL'
OFF = 'OFF'
classmethod validate(mode: str) str[source]

Validate and normalize a journal mode string.

Parameters:

mode (str) – The journal mode string to validate.

Returns:

The normalized (uppercase) journal mode string.

Return type:

str

Raises:

ValueError – If the journal mode is not valid.

class neosqlite.options.AutoVacuumMode[source]

Bases: object

Represents SQLite auto_vacuum modes. Controls how SQLite reclaims space after deleting data.

NONE = 0
FULL = 1
INCREMENTAL = 2
classmethod validate(mode: int | str) int[source]

Validate and normalize an auto_vacuum mode.

Parameters:

mode – The auto_vacuum mode (0, 1, 2) or string (“NONE”, “FULL”, “INCREMENTAL”).

Returns:

The normalized auto_vacuum mode value.

Return type:

int

Raises:

ValueError – If the auto_vacuum mode is not valid.

classmethod to_string(mode: int) str[source]

Convert numeric mode to string representation.