Skip to content

Latest commit

Β 

History

History
92 lines (71 loc) Β· 2.81 KB

File metadata and controls

92 lines (71 loc) Β· 2.81 KB

Chat with Databricks Genie

A Google Chat bot integration with Databricks Genie for natural language queries on your data.

Features

  • πŸ€– Natural language queries to SQL conversion
  • πŸ“‹ Formatted table responses in chat
  • πŸ”„ Async processing for complex queries
  • πŸ’¬ Support for both DM and Space conversations
  • πŸ” Secure authentication with service accounts
  • ⚑ Real-time and async response handling
  • πŸ”Ž Can show the SQL query used (optional)

Upcoming Features

  • πŸ”€ Switch between Genie spaces with Chat commands
  • πŸ“ Export large data volume response directly to a Google Sheet

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Google Chat │───>β”‚  Apps Script │───>β”‚  Databricks  β”‚
β”‚              β”‚<───│    ChatBot   β”‚<───│    Genie     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Setup

  1. Configure Databricks Genie Space:
const CONFIG = {
  DATABRICKS: {
    INSTANCES: [
      {
        name: 'Primary Instance',
        baseUrl: 'https://your-instance.cloud.databricks.com',
        genieSpaceId: 'your-space-id'
      }
    ]
  }
}
  1. Set up Google Service Account:
  • Create service account in Google Cloud Console
  • Download JSON credentials
  • Update CONFIG.GOOGLE_SERVICE_ACCOUNT with credentials
  1. Deploy as Google Chat App:
  • Create new deployment in Apps Script
  • Configure OAuth consent screen
  • Enable Google Chat API
  • Add bot to spaces/DMs

Usage

Ask questions in natural language:

Chat Input: Get monthly sales for the last 3 months
Chat Response: 
πŸ€– Response: This report summarizes the total sales amount for each month over the last three months, organized by month and year.

πŸ“‹ Results:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ month β”‚ year β”‚ total_sales_amount β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 5     β”‚ 2025 β”‚ 12000.00           β”‚
β”‚ 4     β”‚ 2025 β”‚ 11000.00           β”‚
β”‚ 3     β”‚ 2025 β”‚ 10000.00           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Configuration

Setting Description Default
SYNC_TIMEOUT Max sync processing time 25s
MESSAGE_POLL_INTERVAL Status check frequency 3s
ASYNC_TIMEOUT Max async processing time 1h

License

MIT License

Authors

  • Chintan Shah - Initial work

Status

Active development - Currently in beta testing