Class PostgresIndexStore (0.2.1)

PostgresIndexStore(
    key: object,
    engine: llama_index_cloud_sql_pg.engine.PostgresEngine,
    index_store: llama_index_cloud_sql_pg.async_index_store.AsyncPostgresIndexStore,
)

Index Store Table stored in an Cloud SQL for PostgreSQL database.

Methods

PostgresIndexStore

PostgresIndexStore(
    key: object,
    engine: llama_index_cloud_sql_pg.engine.PostgresEngine,
    index_store: llama_index_cloud_sql_pg.async_index_store.AsyncPostgresIndexStore,
)

PostgresIndexStore constructor.

Parameters
Name Description
key object

Key to prevent direct constructor usage.

engine PostgresEngine

Database connection pool.

index_store AsyncPostgresIndexStore

The async only IndexStore implementation

Exceptions
Type Description
Exception If constructor is directly called by the user.

aadd_index_struct

aadd_index_struct(
    index_struct: llama_index.core.data_structs.data_structs.IndexStruct,
) -> None

Add an index struct.

Parameter
Name Description
index_struct IndexStruct

index struct

add_index_struct

add_index_struct(
    index_struct: llama_index.core.data_structs.data_structs.IndexStruct,
) -> None

Add an index struct.

Parameter
Name Description
index_struct IndexStruct

index struct

adelete_index_struct

adelete_index_struct(key: str) -> None

Delete an index struct.

Parameter
Name Description
key str

index struct key

aget_index_struct

aget_index_struct(
    struct_id: typing.Optional[str] = None,
) -> typing.Optional[llama_index.core.data_structs.data_structs.IndexStruct]

Get an index struct.

Parameter
Name Description
struct_id Optional[str]

index struct id

aindex_structs

aindex_structs() -> list[llama_index.core.data_structs.data_structs.IndexStruct]

Get all index structs.

Returns
Type Description
list[IndexStruct] index structs

create

create(
    engine: llama_index_cloud_sql_pg.engine.PostgresEngine,
    table_name: str,
    schema_name: str = "public",
) -> llama_index_cloud_sql_pg.index_store.PostgresIndexStore

Create a new PostgresIndexStore instance.

Parameters
Name Description
engine PostgresEngine

Postgres engine to use.

table_name str

Table name that stores the index metadata.

schema_name str

The schema name where the table is located. Defaults to "public"

Exceptions
Type Description
ValueError If the table provided does not contain required schema.
Returns
Type Description
PostgresIndexStore A newly created instance of PostgresIndexStore.

create_sync

create_sync(
    engine: llama_index_cloud_sql_pg.engine.PostgresEngine,
    table_name: str,
    schema_name: str = "public",
) -> llama_index_cloud_sql_pg.index_store.PostgresIndexStore

Create a new PostgresIndexStore sync instance.

Parameters
Name Description
engine PostgresEngine

Postgres engine to use.

table_name str

Table name that stores the index metadata.

schema_name str

The schema name where the table is located. Defaults to "public"

Exceptions
Type Description
ValueError If the table provided does not contain required schema.
Returns
Type Description
PostgresIndexStore A newly created instance of PostgresIndexStore.

delete_index_struct

delete_index_struct(key: str) -> None

Delete an index struct.

Parameter
Name Description
key str

index struct key

get_index_struct

get_index_struct(
    struct_id: typing.Optional[str] = None,
) -> typing.Optional[llama_index.core.data_structs.data_structs.IndexStruct]

Get an index struct.

Parameter
Name Description
struct_id Optional[str]

index struct id

index_structs

index_structs() -> list[llama_index.core.data_structs.data_structs.IndexStruct]

Get all index structs.

Returns
Type Description
list[IndexStruct] index structs