Skip to content

API Reference parrot.stores.bigquery

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.stores.bigquery

View source

Alias AbstractStore

Re-exported from parrot.stores.abstract.AbstractStore.

Alias BIGQUERY_CREDENTIALS

Re-exported from parrot.conf.BIGQUERY_CREDENTIALS.

Alias BIGQUERY_DATASET

Re-exported from parrot.conf.BIGQUERY_DATASET.

Alias BIGQUERY_PROJECT_ID

Re-exported from parrot.conf.BIGQUERY_PROJECT_ID.

Class BigQueryStore

A BigQuery vector store implementation for storing and searching embeddings. This store provides vector similarity search capabilities using BigQuery's ML functions.

Parameter Type Default Description
table str None
dataset str None
project_id str None
credentials str None
id_column str 'id'
embedding_column str 'embedding'
document_column str 'document'
text_column str 'text'
metadata_column str 'metadata'
embedding_model Union[dict, str] 'sentence-transformers/all-mpnet-base-v2'
embedding Optional[Callable] None
distance_strategy DistanceStrategy DistanceStrategy.COSINE
auto_initialize bool True
**kwargs {}

Method BigQueryStore.get_vector

get_vector(metric_type: str = None, **kwargs)

Parameter Type Default Description
metric_type str None
**kwargs {}

Method BigQueryStore.connection

Initialize BigQuery client. Assuming that authentication is handled outside (via environment variables or similar)

connection()

Method BigQueryStore.initialize_database

Initialize BigQuery dataset and any required setup.

initialize_database()

Method BigQueryStore.dataset_exists

Check if a dataset exists in BigQuery.

dataset_exists(dataset: str = None) -> bool

Parameter Type Default Description
dataset str None

Returns: bool

Method BigQueryStore.create_dataset

Create a new dataset in BigQuery.

create_dataset(dataset: str = None, location: str = 'US') -> Any

Parameter Type Default Description
dataset str None
location str 'US'

Returns: Any

Method BigQueryStore.collection_exists

Check if a collection (table) exists in BigQuery.

collection_exists(table: str, dataset: str = None) -> bool

Parameter Type Default Description
table str
dataset str None

Returns: bool

Method BigQueryStore.create_collection

Create a new collection (table) in BigQuery.

create_collection(table: str, dataset: str = None, dimension: int = 768, id_column: str = None, embedding_column: str = None, document_column: str = None, metadata_column: str = None, **kwargs) -> None

Parameter Type Default Description
table str
dataset str None
dimension int 768
id_column str None
embedding_column str None
document_column str None
metadata_column str None
**kwargs {}

Method BigQueryStore.drop_collection

Drops the specified table in the given dataset.

drop_collection(table: str, dataset: str = None) -> None

Parameter Type Default Description
table str The name of the table to drop.
dataset str None The dataset where the table resides (optional, uses default if not provided).

Method BigQueryStore.prepare_embedding_table

Prepare an existing BigQuery table for embedding storage.

prepare_embedding_table(table: str, dataset: str = None, dimension: int = 768, id_column: str = 'id', embedding_column: str = 'embedding', document_column: str = 'document', metadata_column: str = 'metadata', **kwargs) -> bool

Parameter Type Default Description
table str
dataset str None
dimension int 768
id_column str 'id'
embedding_column str 'embedding'
document_column str 'document'
metadata_column str 'metadata'
**kwargs {}

Returns: bool

Method BigQueryStore.add_documents

Add documents to BigQuery table with embeddings.

add_documents(documents: List[Document], table: str = None, dataset: str = None, embedding_column: str = 'embedding', content_column: str = 'document', metadata_column: str = 'metadata', **kwargs) -> None

Parameter Type Default Description
documents List[Document]
table str None
dataset str None
embedding_column str 'embedding'
content_column str 'document'
metadata_column str 'metadata'
**kwargs {}

Method BigQueryStore.similarity_search

Perform similarity search using BigQuery ML functions.

similarity_search(query: str, table: str = None, dataset: str = None, k: Optional[int] = None, limit: int = None, metadata_filters: Optional[Dict[str, Any]] = None, score_threshold: Optional[float] = None, metric: str = None, embedding_column: str = 'embedding', content_column: str = 'document', metadata_column: str = 'metadata', id_column: str = 'id', **kwargs) -> List[SearchResult]

Parameter Type Default Description
query str
table str None
dataset str None
k Optional[int] None
limit int None
metadata_filters Optional[Dict[str, Any]] None
score_threshold Optional[float] None
metric str None
embedding_column str 'embedding'
content_column str 'document'
metadata_column str 'metadata'
id_column str 'id'
**kwargs {}

Returns: List[SearchResult]

Method BigQueryStore.mmr_search

Perform Maximal Marginal Relevance (MMR) search.

Since BigQuery doesn't have native MMR support, we fetch more candidates and perform MMR selection in Python.

mmr_search(query: str, table: str = None, dataset: str = None, k: int = 10, fetch_k: int = None, lambda_mult: float = 0.5, metadata_filters: Optional[Dict[str, Any]] = None, score_threshold: Optional[float] = None, metric: str = None, embedding_column: str = 'embedding', content_column: str = 'document', metadata_column: str = 'metadata', id_column: str = 'id', **kwargs) -> List[SearchResult]

Parameter Type Default Description
query str
table str None
dataset str None
k int 10
fetch_k int None
lambda_mult float 0.5
metadata_filters Optional[Dict[str, Any]] None
score_threshold Optional[float] None
metric str None
embedding_column str 'embedding'
content_column str 'document'
metadata_column str 'metadata'
id_column str 'id'
**kwargs {}

Returns: List[SearchResult]

Method BigQueryStore.delete_documents

Delete documents from BigQuery table based on metadata field values.

delete_documents(documents: Optional[List[Document]] = None, pk: str = 'source_type', values: Optional[Union[str, List[str]]] = None, table: Optional[str] = None, dataset: Optional[str] = None, metadata_column: Optional[str] = None, **kwargs) -> int

Parameter Type Default Description
documents Optional[List[Document]] None
pk str 'source_type'
values Optional[Union[str, List[str]]] None
table Optional[str] None
dataset Optional[str] None
metadata_column Optional[str] None
**kwargs {}

Returns: int

Method BigQueryStore.delete_documents_by_filter

Deletes documents based on multiple metadata field conditions.

delete_documents_by_filter(filter_dict: Dict[str, Union[str, List[str]]], table: Optional[str] = None, dataset: Optional[str] = None) -> int

Parameter Type Default Description
filter_dict Dict[str, Union[str, List[str]]]
table Optional[str] None
dataset Optional[str] None

Returns: int

Method BigQueryStore.delete_documents_by_ids

Delete documents by their IDs.

delete_documents_by_ids(document_ids: List[str], table: Optional[str] = None, dataset: Optional[str] = None, id_column: Optional[str] = None, **kwargs) -> int

Parameter Type Default Description
document_ids List[str]
table Optional[str] None
dataset Optional[str] None
id_column Optional[str] None
**kwargs {}

Returns: int

Method BigQueryStore.delete_all_documents

Delete ALL documents from the BigQuery table.

delete_all_documents(table: Optional[str] = None, dataset: Optional[str] = None, confirm: bool = False, **kwargs) -> int

Parameter Type Default Description
table Optional[str] None
dataset Optional[str] None
confirm bool False
**kwargs {}

Returns: int

Method BigQueryStore.count_documents_by_filter

Count documents that would be affected by a filter.

count_documents_by_filter(filter_dict: Dict[str, Union[str, List[str]]], table: Optional[str] = None, dataset: Optional[str] = None, metadata_column: Optional[str] = None, **kwargs) -> int

Parameter Type Default Description
filter_dict Dict[str, Union[str, List[str]]]
table Optional[str] None
dataset Optional[str] None
metadata_column Optional[str] None
**kwargs {}

Returns: int

Method BigQueryStore.delete_collection

Delete a collection (table) from BigQuery.

delete_collection(table: str, dataset: str = None) -> None

Parameter Type Default Description
table str
dataset str None

Method BigQueryStore.from_documents

Add documents using late chunking strategy (if available).

from_documents(documents: List[Document], table: str = None, dataset: str = None, embedding_column: str = 'embedding', content_column: str = 'document', metadata_column: str = 'metadata', chunk_size: int = 8192, chunk_overlap: int = 200, store_full_document: bool = True, **kwargs) -> Dict[str, Any]

Parameter Type Default Description
documents List[Document]
table str None
dataset str None
embedding_column str 'embedding'
content_column str 'document'
metadata_column str 'metadata'
chunk_size int 8192
chunk_overlap int 200
store_full_document bool True
**kwargs {}

Returns: Dict[str, Any]

Method BigQueryStore.disconnect

Disconnect from BigQuery (cleanup resources).

disconnect() -> None

Alias DistanceStrategy

Re-exported from parrot.stores.models.DistanceStrategy.

Alias Document

Re-exported from parrot.stores.models.Document.

Alias DriverError

Re-exported from parrot.exceptions.DriverError.

Alias LateChunkingProcessor

Re-exported from parrot.stores.utils.chunking.LateChunkingProcessor.

Alias SearchResult

Re-exported from parrot.stores.models.SearchResult.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally