Skip to main content

Integrate Google BigQuery with Langflow

Langflow integrates with Google BigQuery through the BigQuery component, allowing you to execute SQL queries and retrieve data from your BigQuery datasets.

Prerequisites

Create a service account with BigQuery access

  1. Select and enable your Google Cloud project. For more information, see Create a Google Cloud project.
  2. Create a service account in your Google Cloud project. For more information, see Create a service account.
  3. Assign the BigQuery Job User role to your new account. This role allows Langflow to access BigQuery resources with the service account. You may also need to allow access to your BigQuery dataset. For more information, see BigQuery access control with IAM.
  4. To generate a new JSON key for the service account, navigate to your service account.
  5. Click Add Key, and then click Create new key.
  6. Under Key type, select JSON, and then click Create. A JSON private key file is downloaded to your machine. Now that you have a service account and a JSON private key, you need to configure the credentials in the Langflow BigQuery component.

Configure credentials in the Langflow component

With your service account configured and your credentials JSON file created, follow these steps to authenticate the Langflow application.

  1. Create a new project in Langflow.
  2. From the components sidebar, drag and drop the BigQuery component to your workspace.
  3. In the BigQuery component's Upload Service Account JSON field, click Select file.
  4. In the My Files pane, select Click or drag files here. Your file browser opens.
  5. In your file browser, select the service account JSON file, and then click Open.
  6. In the My Files pane, select your service account JSON file, and then click Select files. The BigQuery component can now query your datasets and tables using your service account JSON file.

Query a BigQuery dataset

With your component credentials configured, query your BigQuery datasets and tables to confirm connectivity.

  1. Connect a Chat input and Chat output component to the BigQuery component. The flow looks like this: BigQuery component connected to chat input and output

  2. Open the Playground, and then submit a valid SQL query. This example queries a table of Oscar winners stored within a BigQuery dataset called the_oscar_award.


    _10
    SELECT film, category, year_film
    _10
    FROM `big-query-langflow-project.the_oscar_award.oscar_winners`
    _10
    WHERE winner = TRUE
    _10
    LIMIT 10

    A successful chat confirms the component can access the BigQuery table.

Search