Skip to content

Document stores

zenpyre.document_stores

Contain document stores.

zenpyre.document_stores.BaseDocumentStore

Bases: ABC

Abstract base class for document stores.

Defines the common interface that all document store implementations must provide. Concrete implementations include :class:~zenpyre.document_stores.InMemoryDocumentStore, :class:~zenpyre.document_stores.SQLiteDocumentStore, :class:~zenpyre.document_stores.DuckDBDocumentStore, and their typed variants which store known metadata fields as native columns for faster filtering.

To implement a custom document store, subclass :class:BaseDocumentStore and implement all abstract methods.

Implementations are expected to support use as a context manager (with SomeDocumentStore(...) as store: ...), which calls :meth:close automatically on exit.

zenpyre.document_stores.BaseDocumentStore.add_documents abstractmethod

add_documents(docs: list[Document]) -> None

Add or replace documents in the store.

Documents whose id already exists should be replaced (upsert semantics).

Parameters:

Name Type Description Default
docs list[Document]

The list of :class:~langchain_core.documents.Document instances to add. Each document must have an id.

required

Raises:

Type Description
ValueError

If any document has no id.

zenpyre.document_stores.BaseDocumentStore.all abstractmethod

all() -> list[Document]

Return all documents in the store.

Returns:

Type Description
list[Document]

A list of all :class:~langchain_core.documents.Document

list[Document]

instances currently in the store.

zenpyre.document_stores.BaseDocumentStore.check_ids abstractmethod

check_ids(
    doc_ids: list[str],
) -> tuple[list[str], list[str]]

Check which document IDs exist in the store.

Parameters:

Name Type Description Default
doc_ids list[str]

The document IDs to check.

required

Returns:

Type Description
list[str]

A tuple of two lists: (found, missing) where found

list[str]

contains the IDs that exist in the store and missing

tuple[list[str], list[str]]

contains the IDs that do not.

zenpyre.document_stores.BaseDocumentStore.close abstractmethod

close() -> None

Close the store and release any underlying resources (e.g. database connections, file handles).

Implementations should make repeated calls to close() safe (i.e. idempotent), since :meth:__exit__ calls it unconditionally and callers may also close a store manually before using it as a context manager.

zenpyre.document_stores.BaseDocumentStore.count abstractmethod

count() -> int

Return the total number of documents in the store.

Returns:

Type Description
int

The number of documents currently stored.

zenpyre.document_stores.BaseDocumentStore.delete abstractmethod

delete(doc_id: str) -> None

Delete a document by its ID.

IDs that do not exist should be silently ignored.

Parameters:

Name Type Description Default
doc_id str

The ID of the document to delete.

required

zenpyre.document_stores.BaseDocumentStore.delete_many abstractmethod

delete_many(doc_ids: list[str]) -> None

Delete multiple documents by their IDs.

IDs that do not exist should be silently ignored.

Parameters:

Name Type Description Default
doc_ids list[str]

The IDs of the documents to delete.

required

zenpyre.document_stores.BaseDocumentStore.filter abstractmethod

filter(**metadata_filters: Any) -> list[Document]

Retrieve documents matching all provided metadata filters.

All filters should be combined with AND. Each keyword argument matches the corresponding metadata key exactly.

Parameters:

Name Type Description Default
**metadata_filters Any

Key-value pairs where each key is a metadata field name and the value is the exact value to match. Calling with no arguments should return all documents.

{}

Returns:

Type Description
list[Document]

A list of matching

list[Document]

class:~langchain_core.documents.Document instances.

zenpyre.document_stores.BaseDocumentStore.get abstractmethod

get(doc_id: str) -> Document | None

Retrieve a single document by its ID.

Parameters:

Name Type Description Default
doc_id str

The document ID to look up.

required

Returns:

Name Type Description
The Document | None

class:~langchain_core.documents.Document, or

Document | None

None if not found.

zenpyre.document_stores.BaseDocumentStore.get_many abstractmethod

get_many(doc_ids: list[str]) -> list[Document | None]

Retrieve multiple documents by their IDs.

Parameters:

Name Type Description Default
doc_ids list[str]

The document IDs to look up.

required

Returns:

Name Type Description
list[Document | None]

A list the same length as doc_ids, with the

corresponding list[Document | None]

class:~langchain_core.documents.Document

list[Document | None]

for each ID that exists, or None for IDs not found.

zenpyre.document_stores.BaseDocumentStore.iter_batches abstractmethod

iter_batches(
    batch_size: int = 32,
) -> Generator[list[Document], None, None]

Yield documents in batches, avoiding loading the whole store into memory at once.

This is the scalable equivalent of :meth:all: instead of materializing every document as a single list, it streams them from the database in chunks of batch_size.

Parameters:

Name Type Description Default
batch_size int

The maximum number of documents to yield per batch. Must be a positive integer.

32

Yields:

Type Description
list[Document]

Lists of documents, each with at most batch_size

list[Document]

elements, in the same order as :meth:all. The last batch

list[Document]

may contain fewer than batch_size documents.

Example
>>> from zenpyre.document_stores import InMemoryDocumentStore
>>> from langchain_core.documents import Document
>>> store = InMemoryDocumentStore()
>>> store.add_documents([Document(id=str(i), page_content=str(i)) for i in range(5)])
>>> for batch in store.iter_batches(batch_size=2):
...     print(len(batch))
...
2
2
1

zenpyre.document_stores.BaseDocumentStore.lazy_all

lazy_all(batch_size: int = 32) -> Iterator[Document]

Lazily iterate over all documents without loading them all into memory at once.

Parameters:

Name Type Description Default
batch_size int

The batch size used internally when pulling documents from the underlying store. Does not affect the granularity of what is yielded — documents are always yielded one at a time.

32

Yields:

Name Type Description
One Document

class:~langchain_core.documents.Document at a time,

Document

in the same order as :meth:all.

zenpyre.document_stores.DuckDBDocumentStore

Bases: BaseDuckDBDocumentStore

A DuckDB-backed store for LangChain documents.

Persists documents to a DuckDB database and supports adding, retrieving, filtering, and deleting documents. All metadata is stored as a JSON column, which provides flexibility for arbitrary metadata fields without requiring a fixed schema. For better query performance on known metadata fields, see :class:TypedDuckDBDocumentStore.

Parameters:

Name Type Description Default
path Path | str

Path to the DuckDB file, or ":memory:" for an in-memory database (useful for testing).

':memory:'
**kwargs Any

Additional keyword arguments to pass to duckdb.connect.

{}
Example
>>> from zenpyre.document_stores import DuckDBDocumentStore
>>> from langchain_core.documents import Document
>>> store = DuckDBDocumentStore(":memory:")
>>> docs = [
...     Document(
...         id="1",
...         page_content="Intro to Python",
...         metadata={"author": "Alice", "category": "Programming"},
...     ),
...     Document(
...         id="2",
...         page_content="Advanced Python",
...         metadata={"author": "Alice", "category": "Programming"},
...     ),
...     Document(
...         id="3",
...         page_content="History of Rome",
...         metadata={"author": "Bob", "category": "History"},
...     ),
... ]
>>> store.add_documents(docs)
>>> len(store.filter(author="Alice"))
2
>>> len(store.filter(author="Alice", category="Programming"))
2
>>> len(store.filter(category="History"))
1

zenpyre.document_stores.InMemoryDocumentStore

Bases: BaseDocumentStore, InlineDisplayMixin

A :class:~zenpyre.document_stores.base.BaseDocumentStore implementation backed by a plain dict.

Documents are keyed by their id and held entirely in process memory -- nothing is persisted to disk. This is primarily useful for testing, small-scale exploration, or pipelines that don't need durability.

Documents are deep-copied on both write and read so that mutating a :class:~langchain_core.documents.Document returned by this store (or a document passed into :meth:add_documents) never affects the store's internal state. This trades some performance for isolation; for very large documents or hot loops, consider a store that doesn't copy on every access.

Example
>>> from langchain_core.documents import Document
>>> from zenpyre.document_stores import InMemoryDocumentStore
>>> store = InMemoryDocumentStore()
>>> store.add_documents([Document(id="1", page_content="hello")])
>>> store.count()
1
>>> store.get("1").page_content
'hello'

zenpyre.document_stores.SQLiteDocumentStore

Bases: BaseSQLiteDocumentStore

A SQLite-backed store for LangChain :class:~langchain_core.documents.Document objects.

Persists documents to a SQLite database and supports adding, retrieving, filtering, and deleting documents. All metadata is stored as a JSON column (using SQLite's built-in json1 functions), which provides flexibility for arbitrary metadata fields without requiring a fixed schema.

The constructor mirrors :func:sqlite3.connect directly. For the common case of opening a file by path (optionally read-only), use :meth:from_path instead.

Parameters:

Name Type Description Default
database Path | str

The database argument passed to sqlite3.connect (path, ":memory:", or file: URI).

':memory:'
**kwargs Any

Additional keyword arguments to pass to sqlite3.connect.

{}
Example
>>> from zenpyre.document_stores import SQLiteDocumentStore
>>> from langchain_core.documents import Document
>>> store = SQLiteDocumentStore(":memory:")
>>> docs = [
...     Document(
...         id="1",
...         page_content="Intro to Python",
...         metadata={"author": "Alice", "category": "Programming"},
...     ),
...     Document(
...         id="2",
...         page_content="Advanced Python",
...         metadata={"author": "Alice", "category": "Programming"},
...     ),
...     Document(
...         id="3",
...         page_content="History of Rome",
...         metadata={"author": "Bob", "category": "History"},
...     ),
... ]
>>> store.add_documents(docs)
>>> len(store.filter(author="Alice"))
2
>>> len(store.filter(author="Alice", category="Programming"))
2
>>> len(store.filter(category="History"))
1

zenpyre.document_stores.SQLiteDocumentStore.from_path classmethod

from_path(
    path: Path | str,
    *,
    read_only: bool = False,
    **kwargs: Any
) -> SQLiteDocumentStore

Construct a :class:SQLiteDocumentStore from a file path.

Builds the appropriate file: URI for sqlite3.connect, including read-only access, so callers don't need to construct SQLite URIs themselves.

Parameters:

Name Type Description Default
path Path | str

Path to the SQLite file, or ":memory:" for an in-memory database (useful for testing).

required
read_only bool

If True, open the database in read-only mode. The database file must already exist.

False
**kwargs Any

Additional keyword arguments to pass to sqlite3.connect.

{}

Returns:

Type Description
SQLiteDocumentStore

A new :class:SQLiteDocumentStore connected to path.

zenpyre.document_stores.TypedDuckDBDocumentStore

Bases: BaseDuckDBDocumentStore

A DuckDB-backed store for LangChain documents with metadata filtering.

Persists documents to a DuckDB database and supports adding, retrieving, and filtering by metadata fields. An optional metadata_schema maps known metadata field names to DuckDB types. Known fields are stored as typed columns for fast, index-friendly queries. Any metadata fields not in the schema are stored in an extra JSON overflow column, so nothing is lost.

Parameters:

Name Type Description Default
path Path | str

Path to the DuckDB file, or ":memory:" for an in-memory database (useful for testing).

':memory:'
metadata_schema dict[str, str] | None

Optional mapping of metadata field names to DuckDB type strings (e.g. {"ticker": "VARCHAR", "cik": "INTEGER", "year": "INTEGER"}). Fields in the schema get native typed columns; all other metadata fields go into the extra JSON overflow column. Defaults to None, which stores all metadata as JSON only.

None
**kwargs Any

Additional keyword arguments to pass to duckdb.connect.

{}
Example
>>> from zenpyre.document_stores import TypedDuckDBDocumentStore
>>> from langchain_core.documents import Document
>>> schema = {"author": "VARCHAR", "year": "INTEGER", "category": "VARCHAR"}
>>> store = TypedDuckDBDocumentStore(":memory:", metadata_schema=schema)
>>> docs = [
...     Document(
...         id="1",
...         page_content="Introduction to Python",
...         metadata={"author": "Alice", "year": 2022, "category": "Programming"},
...     ),
...     Document(
...         id="2",
...         page_content="Advanced Python",
...         metadata={"author": "Alice", "year": 2023, "category": "Programming"},
...     ),
...     Document(
...         id="3",
...         page_content="History of Rome",
...         metadata={"author": "Bob", "year": 2021, "category": "History"},
...     ),
... ]
>>> store.add_documents(docs)
>>> len(store.filter(author="Alice"))
2
>>> len(store.filter(author="Alice", category="Programming"))
2
>>> len(store.filter(category="History"))
1

zenpyre.document_stores.TypedSQLiteDocumentStore

Bases: BaseSQLiteDocumentStore

A SQLite-backed store for LangChain documents with metadata filtering.

Persists documents to a SQLite database and supports adding, retrieving, and filtering by metadata fields. An optional metadata_schema maps known metadata field names to SQLite types. Known fields are stored as typed columns for fast, index-friendly queries. Any metadata fields not in the schema are stored in an extra JSON overflow column, so nothing is lost.

The constructor mirrors :func:sqlite3.connect directly (plus the metadata_schema argument). For the common case of opening a file by path (optionally read-only), use :meth:from_path instead.

Parameters:

Name Type Description Default
database Path | str

The database argument passed to sqlite3.connect (path, ":memory:", or file: URI).

':memory:'
metadata_schema dict[str, str] | None

Optional mapping of metadata field names to SQLite type strings (e.g. {"ticker": "TEXT", "cik": "INTEGER", "year": "INTEGER"}). Fields in the schema get native typed columns; all other metadata fields go into the extra JSON overflow column. Defaults to None, which stores all metadata as JSON only.

None
**kwargs Any

Additional keyword arguments to pass to sqlite3.connect.

{}
Example
>>> from zenpyre.document_stores import TypedSQLiteDocumentStore
>>> from langchain_core.documents import Document
>>> schema = {"author": "TEXT", "year": "INTEGER", "category": "TEXT"}
>>> store = TypedSQLiteDocumentStore(":memory:", metadata_schema=schema)
>>> docs = [
...     Document(
...         id="1",
...         page_content="Intro to Python",
...         metadata={"author": "Alice", "year": 2022, "category": "Programming"},
...     ),
...     Document(
...         id="2",
...         page_content="Advanced Python",
...         metadata={"author": "Alice", "year": 2023, "category": "Programming"},
...     ),
...     Document(
...         id="3",
...         page_content="History of Rome",
...         metadata={"author": "Bob", "year": 2021, "category": "History"},
...     ),
... ]
>>> store.add_documents(docs)
>>> len(store.filter(author="Alice"))
2
>>> len(store.filter(author="Alice", category="Programming"))
2
>>> len(store.filter(category="History"))
1

zenpyre.document_stores.TypedSQLiteDocumentStore.from_path classmethod

from_path(
    path: Path | str,
    *,
    metadata_schema: dict[str, str] | None = None,
    read_only: bool = False,
    **kwargs: Any
) -> TypedSQLiteDocumentStore

Construct a :class:TypedSQLiteDocumentStore from a file path.

Builds the appropriate file: URI for sqlite3.connect, including read-only access, so callers don't need to construct SQLite URIs themselves.

Parameters:

Name Type Description Default
path Path | str

Path to the SQLite file, or ":memory:" for an in-memory database (useful for testing).

required
metadata_schema dict[str, str] | None

Optional mapping of metadata field names to SQLite type strings. See the class docstring.

None
read_only bool

If True, open the database in read-only mode. The database file must already exist.

False
**kwargs Any

Additional keyword arguments to pass to sqlite3.connect.

{}

Returns:

Type Description
TypedSQLiteDocumentStore

A new :class:TypedSQLiteDocumentStore connected to path.

zenpyre.document_stores.resolve_document_store

resolve_document_store(
    document_store: (
        BaseDocumentStore | dict[str, Any] | BaseConfig
    ),
) -> BaseDocumentStore

Resolve a :class:~zenpyre.document_stores.base.BaseDocumentStore instance from an existing object, a configuration dictionary, or a :class:~zenpyre.utils.config.BaseConfig.

If document_store is already a :class:~zenpyre.document_stores.base.BaseDocumentStore instance it is returned as-is. If it is a :class:dict or a :class:~zenpyre.utils.config.BaseConfig, it is treated as an objectory factory configuration and instantiated via :func:objectory.factory. See :func:~zenpyre.utils.resolve.resolve_object for details.

Parameters:

Name Type Description Default
document_store BaseDocumentStore | dict[str, Any] | BaseConfig

Either a fully configured :class:~zenpyre.document_stores.base.BaseDocumentStore instance, a :class:dict containing an objectory factory specification (must include a "_target_" key pointing to the fully-qualified class name), or a :class:~zenpyre.utils.config.BaseConfig whose to_kwargs() includes a "_target_" key.

required

Returns:

Type Description
BaseDocumentStore

A configured

BaseDocumentStore

class:~zenpyre.document_stores.base.BaseDocumentStore

BaseDocumentStore

instance.

Raises:

Type Description
TypeError

If the resolved object is not a :class:~zenpyre.document_stores.base.BaseDocumentStore instance.

Example
>>> from zenpyre.document_stores import InMemoryDocumentStore, resolve_document_store
>>> # From an existing instance:
>>> document_store = resolve_document_store(InMemoryDocumentStore())
>>> # From a configuration dictionary:
>>> document_store = resolve_document_store(
...     {"_target_": "zenpyre.document_stores.InMemoryDocumentStore"}
... )

zenpyre.document_stores.factory

Contain factories for document stores.

zenpyre.document_stores.factory.BaseDocumentStoreFactory

Bases: ABC

Abstract base class for :class:~zenpyre.document_stores.base.BaseDocumentStore factories.

Subclasses implement :meth:make_document_store to instantiate and return a configured :class:~zenpyre.document_stores.base.BaseDocumentStore object. This pattern decouples document store creation from the rest of the codebase, making it easy to swap document stores (e.g. in-memory, SQLite, DuckDB) without changing call sites.

Example
>>> from zenpyre.document_stores import InMemoryDocumentStore
>>> from zenpyre.document_stores.base import BaseDocumentStore
>>> from zenpyre.document_stores.factory import BaseDocumentStoreFactory
>>> class MyDocumentStoreFactory(BaseDocumentStoreFactory):
...     def make_document_store(self) -> BaseDocumentStore:
...         return InMemoryDocumentStore()
...
>>> factory = MyDocumentStoreFactory()
>>> document_store = factory.make_document_store()

zenpyre.document_stores.factory.BaseDocumentStoreFactory.make_document_store abstractmethod

make_document_store() -> BaseDocumentStore

Create and return a configured BaseDocumentStore instance.

Returns:

Name Type Description
A BaseDocumentStore

class:~zenpyre.document_stores.base.BaseDocumentStore

BaseDocumentStore

instance ready for use.

zenpyre.document_stores.factory.ConfigurableDocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that accepts either a pre- built :class:~zenpyre.document_stores.base.BaseDocumentStore instance or a configuration dictionary.

When a dict is provided it is resolved at each :meth:make_document_store call via :func:~zenpyre.document_stores.resolve.resolve_document_store, which uses objectory to instantiate the configured class. When an instance is provided it is returned as-is.

Parameters:

Name Type Description Default
document_store BaseDocumentStore | dict[str, Any]

A fully configured :class:~zenpyre.document_stores.base.BaseDocumentStore instance, or a :class:dict containing an objectory factory specification (must include a "_target_" key pointing to the fully-qualified class name).

required
Example
>>> from zenpyre.document_stores import InMemoryDocumentStore
>>> from zenpyre.document_stores.factory import ConfigurableDocumentStoreFactory
>>> factory = ConfigurableDocumentStoreFactory(InMemoryDocumentStore())
>>> document_store = factory.make_document_store()

zenpyre.document_stores.factory.DocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that wraps a pre-built :class:~zenpyre.document_stores.base.BaseDocumentStore instance.

Use this when the document store is already instantiated and you simply want to wrap it in the :class:~BaseDocumentStoreFactory interface — for example, when injecting a fixed document store into a component that expects a factory.

Parameters:

Name Type Description Default
document_store BaseDocumentStore

A fully configured :class:~zenpyre.document_stores.base.BaseDocumentStore instance to return from :meth:make_document_store.

required
Example
>>> from zenpyre.document_stores import InMemoryDocumentStore
>>> from zenpyre.document_stores.factory import DocumentStoreFactory
>>> factory = DocumentStoreFactory(InMemoryDocumentStore())
>>> document_store = factory.make_document_store()

zenpyre.document_stores.factory.DuckDBDocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that builds a :class:~zenpyre.document_stores.DuckDBDocumentStore backed by a DuckDB file at a given path.

Use this when you want a factory that lazily constructs a fresh :class:~zenpyre.document_stores.DuckDBDocumentStore at path each time :meth:make_document_store is called, rather than wrapping an already-instantiated store.

Parameters:

Name Type Description Default
path Path | str

The path to the DuckDB file used to back the document store.

required
**kwargs Any

Additional keyword arguments forwarded to :class:~zenpyre.document_stores.DuckDBDocumentStore.

{}
Example
>>> from pathlib import Path
>>> from zenpyre.document_stores.factory import DuckDBDocumentStoreFactory
>>> factory = DuckDBDocumentStoreFactory(Path("/tmp/my_app/documents.duckdb"))
>>> document_store = factory.make_document_store()  # doctest: +SKIP

zenpyre.document_stores.factory.InMemoryDocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that builds a fresh :class:~zenpyre.document_stores.InMemoryDocumentStore on each :meth:make_document_store call.

Use this when you want a factory that lazily constructs a new, empty :class:~zenpyre.document_stores.InMemoryDocumentStore each time :meth:make_document_store is called, rather than wrapping an already-instantiated store (see :class:~zenpyre.document_stores.factory.DocumentStoreFactory for that).

Example
>>> from zenpyre.document_stores.factory import InMemoryDocumentStoreFactory
>>> factory = InMemoryDocumentStoreFactory()
>>> document_store = factory.make_document_store()

zenpyre.document_stores.factory.SQLiteDocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that builds a :class:~zenpyre.document_stores.SQLiteDocumentStore backed by a SQLite file at a given path.

Use this when you want a factory that lazily constructs a fresh :class:~zenpyre.document_stores.SQLiteDocumentStore at path (via :meth:~zenpyre.document_stores.SQLiteDocumentStore.from_path) each time :meth:make_document_store is called, rather than wrapping an already-instantiated store.

Parameters:

Name Type Description Default
path Path | str

The path to the SQLite file used to back the document store, or ":memory:" for an in-memory database.

required
read_only bool

If True, open the database in read-only mode. The database file must already exist.

False
**kwargs Any

Additional keyword arguments forwarded to :meth:~zenpyre.document_stores.SQLiteDocumentStore.from_path.

{}
Example
>>> from pathlib import Path
>>> from zenpyre.document_stores.factory import SQLiteDocumentStoreFactory
>>> factory = SQLiteDocumentStoreFactory(Path("/tmp/my_app/documents.sqlite"))
>>> document_store = factory.make_document_store()  # doctest: +SKIP

zenpyre.document_stores.factory.TypedDuckDBDocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that builds a :class:~zenpyre.document_stores.TypedDuckDBDocumentStore backed by a DuckDB file at a given path.

Use this when you want a factory that lazily constructs a fresh :class:~zenpyre.document_stores.TypedDuckDBDocumentStore at path each time :meth:make_document_store is called, rather than wrapping an already-instantiated store.

Parameters:

Name Type Description Default
path Path | str

The path to the DuckDB file used to back the document store.

required
metadata_schema dict[str, str] | None

Optional mapping of metadata field names to DuckDB type strings. See :class:~zenpyre.document_stores.TypedDuckDBDocumentStore's docstring for details.

None
**kwargs Any

Additional keyword arguments forwarded to :class:~zenpyre.document_stores.TypedDuckDBDocumentStore.

{}
Example
>>> from pathlib import Path
>>> from zenpyre.document_stores.factory import TypedDuckDBDocumentStoreFactory
>>> factory = TypedDuckDBDocumentStoreFactory(Path("/tmp/my_app/documents.duckdb"))
>>> document_store = factory.make_document_store()  # doctest: +SKIP

zenpyre.document_stores.factory.TypedSQLiteDocumentStoreFactory

Bases: BaseDocumentStoreFactory, MultilineDisplayMixin

A concrete BaseDocumentStore factory that builds a :class:~zenpyre.document_stores.TypedSQLiteDocumentStore backed by a SQLite file at a given path.

Use this when you want a factory that lazily constructs a fresh :class:~zenpyre.document_stores.TypedSQLiteDocumentStore at path (via :meth:~zenpyre.document_stores.TypedSQLiteDocumentStore.from_path) each time :meth:make_document_store is called, rather than wrapping an already-instantiated store.

Parameters:

Name Type Description Default
path Path | str

The path to the SQLite file used to back the document store, or ":memory:" for an in-memory database.

required
metadata_schema dict[str, str] | None

Optional mapping of metadata field names to SQLite type strings. See :class:~zenpyre.document_stores.TypedSQLiteDocumentStore's docstring for details.

None
read_only bool

If True, open the database in read-only mode. The database file must already exist.

False
**kwargs Any

Additional keyword arguments forwarded to :meth:~zenpyre.document_stores.TypedSQLiteDocumentStore.from_path.

{}
Example
>>> from pathlib import Path
>>> from zenpyre.document_stores.factory import TypedSQLiteDocumentStoreFactory
>>> factory = TypedSQLiteDocumentStoreFactory(Path("/tmp/my_app/documents.sqlite"))
>>> document_store = factory.make_document_store()  # doctest: +SKIP