Class SpannerLoader (0.5.0)

SpannerLoader(
    instance_id: str,
    database_id: str,
    query: str,
    content_columns: typing.List[str] = [],
    metadata_columns: typing.List[str] = [],
    format: str = "text",
    databoost: bool = False,
    metadata_json_column: str = "langchain_metadata",
    staleness: typing.Union[float, datetime.datetime] = 0.0,
    client: typing.Optional[google.cloud.spanner_v1.client.Client] = None,
)

Loads data from Google Cloud Spanner.

Methods

SpannerLoader

SpannerLoader(
    instance_id: str,
    database_id: str,
    query: str,
    content_columns: typing.List[str] = [],
    metadata_columns: typing.List[str] = [],
    format: str = "text",
    databoost: bool = False,
    metadata_json_column: str = "langchain_metadata",
    staleness: typing.Union[float, datetime.datetime] = 0.0,
    client: typing.Optional[google.cloud.spanner_v1.client.Client] = None,
)

Initialize Spanner document loader.

lazy_load

lazy_load() -> typing.Iterator[langchain_core.documents.base.Document]

A lazy loader for langchain documents from a Spanner database. Use lazy load to avoid caching all documents in memory at once.

Returns
Type Description
(Iterator[langchain_core.documents.Document]) a list of Documents with metadata from specific columns.

load

load() -> typing.List[langchain_core.documents.base.Document]

Load langchain documents from a Spanner database.

Returns
Type Description
(List[langchain_core.documents.Document]) a list of Documents with metadata from specific columns.