Skip to content

Commit

Permalink
a better error description when GCP project is not set (#11377)
Browse files Browse the repository at this point in the history
- **Description:** a little bit better error description
  - **Issue:** #10879
  • Loading branch information
lkuligin authored Oct 4, 2023
1 parent 0d80226 commit 4f4e0f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/langchain/langchain/document_loaders/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def load(self) -> List[Document]:
) from ex

bq_client = bigquery.Client(credentials=self.credentials, project=self.project)
if not bq_client.project:
error_desc = (
"GCP project for Big Query is not set! Either provide a "
"`project` argument during BigQueryLoader instantiation, "
"or set a default project with `gcloud config set project` "
"command."
)
raise ValueError(error_desc)
query_result = bq_client.query(self.query).result()
docs: List[Document] = []

Expand Down

0 comments on commit 4f4e0f3

Please sign in to comment.