DatavineDatavine/Docs
Querying Data

AI SQL & Visual Query Builder

Generate BigQuery SQL from plain English descriptions using Vertex AI (Gemini). Available in the SQL Editor as the Visual Query Builder.

How it works

The Visual Query Builder sends your natural language prompt, your dataset schema, and project context to Google Vertex AI's Gemini model. The model generates a BigQuery-compatible SQL query, which you can review, edit, and run.

AI SQL generation requires a connected GCP project with Vertex AI API enabled. Vertex AI calls use your project's credentials and quota.

Using the Visual Query Builder

  1. Open the SQL Editor
  2. Click Visual Query Builder in the top toolbar
  3. Select the dataset and table you want to query
  4. Describe what you want in the text field
  5. Click Generate SQL
  6. Review the generated query, edit if needed, then click Run

Writing good prompts

Be specific about columns
✗ Vague: Show me sales data
✓ Specific: Show total sales amount grouped by region for Q4 2024, ordered by highest first
Mention time ranges explicitly
✗ Vague: Recent orders
✓ Specific: Orders from the last 30 days where status is completed
Include aggregation intent
✗ Vague: User data
✓ Specific: Count of unique users per country, only countries with more than 1000 users

Limitations

  • Complex multi-table JOINs may require manual adjustment
  • Very large schemas (100+ tables) may reduce accuracy
  • BigQuery-specific syntax like ARRAY_AGG or STRUCT may need review
  • The model doesn't know your data values, only column names and types