Class AlloyDBReader (0.2.3)

AlloyDBReader(
 key: object,
 engine: AlloyDBEngine,
 reader: AsyncAlloyDBReader,
 is_remote: bool = True,
)

Chat Store Table stored in an AlloyDB for PostgreSQL database.

Methods

AlloyDBReader

AlloyDBReader(
 key: object,
 engine: AlloyDBEngine,
 reader: AsyncAlloyDBReader,
 is_remote: bool = True,
)

AlloyDBReader constructor.

Parameters
Name Description
key object

Prevent direct constructor usage.

engine AlloyDBEngine

AlloyDB with pool connection to the alloydb database

reader AsyncAlloyDBReader

The async only AlloyDBReader implementation

is_remote Optional[bool]

Whether the data is loaded from a remote API or a local file.

Exceptions
Type Description
Exception If called directly by user.

alazy_load_data

alazy_load_data() -> typing.AsyncIterable[llama_index.core.schema.Document]

Asynchronously load AlloyDB data into Document objects lazily.

aload_data

aload_data() -> list[llama_index.core.schema.Document]

Asynchronously load AlloyDB data into Document objects.

class_name

class_name() -> str

Get class name.

create

create(
 engine: llama_index_alloydb_pg.engine.AlloyDBEngine,
 query: typing.Optional[str] = None,
 table_name: typing.Optional[str] = None,
 schema_name: str = "public",
 content_columns: typing.Optional[list[str]] = None,
 metadata_columns: typing.Optional[list[str]] = None,
 metadata_json_column: typing.Optional[str] = None,
 format: typing.Optional[str] = None,
 formatter: typing.Optional[typing.Callable] = None,
 is_remote: bool = True,
) -> llama_index_alloydb_pg.reader.AlloyDBReader

Asynchronously create an AlloyDBReader instance.

Parameters
Name Description
engine AlloyDBEngine

AlloyDBEngine with pool connection to the alloydb database

query Optional[str], optional

SQL query. Defaults to None.

table_name Optional[str], optional

Name of table to query. Defaults to None.

schema_name str, optional

Name of the schema where table is located. Defaults to "public".

content_columns Optional[list[str]], optional

Column that represent a Document's page_content. Defaults to the first column.

metadata_columns Optional[list[str]], optional

Column(s) that represent a Document's metadata. Defaults to None.

metadata_json_column Optional[str], optional

Column to store metadata as JSON. Defaults to "li_metadata".

format Optional[str], optional

Format of page content (OneOf: text, csv, YAML, JSON). Defaults to 'text'.

formatter Optional[Callable], optional

A function to format page content (OneOf: format, formatter). Defaults to None.

is_remote Optional[bool]

Whether the data is loaded from a remote API or a local file.

Returns
Type Description
AlloyDBReader A newly created instance of AlloyDBReader.

create_sync

create_sync(
 engine: llama_index_alloydb_pg.engine.AlloyDBEngine,
 query: typing.Optional[str] = None,
 table_name: typing.Optional[str] = None,
 schema_name: str = "public",
 content_columns: typing.Optional[list[str]] = None,
 metadata_columns: typing.Optional[list[str]] = None,
 metadata_json_column: typing.Optional[str] = None,
 format: typing.Optional[str] = None,
 formatter: typing.Optional[typing.Callable] = None,
 is_remote: bool = True,
) -> llama_index_alloydb_pg.reader.AlloyDBReader

Synchronously create an AlloyDBReader instance.

Parameters
Name Description
engine AlloyDBEngine

AsyncEngine with pool connection to the alloydb database

query Optional[str], optional

SQL query. Defaults to None.

table_name Optional[str], optional

Name of table to query. Defaults to None.

schema_name str, optional

Name of the schema where table is located. Defaults to "public".

content_columns Optional[list[str]], optional

Column that represent a Document's page_content. Defaults to the first column.

metadata_columns Optional[list[str]], optional

Column(s) that represent a Document's metadata. Defaults to None.

metadata_json_column Optional[str], optional

Column to store metadata as JSON. Defaults to "li_metadata".

format Optional[str], optional

Format of page content (OneOf: text, csv, YAML, JSON). Defaults to 'text'.

formatter Optional[Callable], optional

A function to format page content (OneOf: format, formatter). Defaults to None.

is_remote Optional[bool]

Whether the data is loaded from a remote API or a local file.

Returns
Type Description
AlloyDBReader A newly created instance of AlloyDBReader.

lazy_load_data

lazy_load_data() -> typing.Iterable[llama_index.core.schema.Document]

Synchronously aoad AlloyDB data into Document objects lazily.

load_data

load_data() -> list[llama_index.core.schema.Document]

Synchronously load AlloyDB data into Document objects.

model_post_init

model_post_init(context: Any, /) -> None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that's what pydantic-core passes when calling it.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.