Skip to main content

No project description provided

Project description

BigQuery Agents

This project implements a conversational agent powered by LangGraph and Google Vertex AI's Gemini model to troubleshoot BigQuery jobs. It utilizes custom tools to fetch job details and table schemas, enabling the agent to provide informed suggestions for fixing errors.

Scripts

  • bq_fix is an AI agent uses Gemini 2.0 Flash. Agent suggests fixes to a problematic query by getting Bigquery job id from user. It uses BigQueryJobDetailsTool and BigQueryTableSchemaTool to get the query and error text and suggests some resolutions. If the error includes data type related ones, it uses BigQueryTableSchemaTool tool to get the table schema for more accurate suggestions.
  • bq_fix_basic is a basic version which does not have the schema lookup functionality. can be useful to resolve syntax issues but not that efficient if the error is related to a column data type compared to bq_fix.

Features

  • BigQuery Job Details Retrieval: Fetches details of a BigQuery job, including the query and any error messages.
  • BigQuery Table Schema Retrieval: Retrieves the schema of a BigQuery table, including column names and data types.
  • Error Analysis and Fix Suggestions: Analyzes job details and errors to suggest possible fixes, leveraging table schema information when necessary.
  • Conversational Interface: Allows users to interact with the agent through a command-line interface.
  • LangGraph State Management: Uses LangGraph to manage the conversation flow and state, including messages, job details, and table schemas.
  • Mermaid Graph Visualization: Generates a Mermaid diagram of the LangGraph flow, saved as graph.jpg.

Prerequisites

  • Python 3.12+
  • Google Cloud Platform (GCP) account with BigQuery enabled
  • PROJECT_ID environment variable set to your GCP project ID or hardcoded in the script.
  • Poetry for dependency management

Installation using pip

  1. Install the pypi package:

    pip install bigquery_agents
    

Installation via Github

  1. Clone the repository:

    git clone https://github.com/samkaradag/bigquery-agents.git
    cd bigquery-agents
    
  2. Install dependencies using Poetry:

    poetry install
    

Usage

  1. Set your GCP project ID:

    export PROJECT_ID="your-gcp-project-id"
    

    Or change the PROJECT_ID variable inside the python script.

  2. Authenticate with GCP:

    gcloud auth application-default login
    
  3. Run the agent using the bq_fix:

    bq_fix
    

Langgraph graph visualization

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigquery_agents-0.1.13.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bigquery_agents-0.1.13-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file bigquery_agents-0.1.13.tar.gz.

File metadata

  • Download URL: bigquery_agents-0.1.13.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0

File hashes

Hashes for bigquery_agents-0.1.13.tar.gz
Algorithm Hash digest
SHA256 91033ebf9a224e5e3780f169bf4e38d2b2407e58decb54d1ae4d1b0e829f717d
MD5 1f65c6734746e797ad7e5c11a62bde71
BLAKE2b-256 40454c836997c771043a67951f9f0f2fc8a660a68e5c4b8aef29044995e7b6ca

See more details on using hashes here.

File details

Details for the file bigquery_agents-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: bigquery_agents-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0

File hashes

Hashes for bigquery_agents-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 a3ff6ea2597571e3a23a4ba6ec579d81b8336d5192e093fbe7faf78e426bd2c7
MD5 6128432404553b393d57f973dfacf5b0
BLAKE2b-256 5ff1e9b60277bbaae11e089a2e7eaf59606522c638b103ad2f35bbd7228899e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page