Menu
Grafana Cloud

SQL workflows

This guide helps you connect observability insights with business or operational data stored in SQL data sources. It shows you how to discover tables, generate queries, and share the results.

What you’ll achieve

  • Inventory relevant tables and schemas without leaving the Assistant.
  • Generate SQL that answers your business question, complete with summarization.
  • Apply the results to dashboards, incidents, or correlation workflows for richer context.

Before you begin

  • SQL data source: Mention it with @ and confirm the Assistant has access.
  • Intent: Describe the business question or metric you want to analyze.

Discover relevant tables

List the schemas and tables tied to your business question so the Assistant knows where to pull data.

  1. Provide the outcome you need and any keywords or schemas. Include example table names or prefixes so the Assistant can filter quickly.
Find tables in @orders-database that track checkout failures or payment status.
  1. Review the Assistant’s list of tables, columns, and sample data to confirm relevance.

Generate the query

Describe the calculation and filters you need so the Assistant can craft SQL tailored to your data source.

  • Describe the calculation, filters, and grouping you need.
  • Break complicated requirements into sequential prompts (discover tables, then pick columns, then build the query) so the Assistant can respond accurately.
Query @orders-database for failed checkouts per minute between 17:30 and 18:00 grouped by payment_provider.
  • Ask for summarization so the Assistant interprets the result and formats the output as a Grafana panel if needed.

Iterate safely

Review the generated SQL for accuracy, performance, and compatibility before you rely on it.

  • Validate performance and syntax, for example, Validate the SQL for compatibility with PostgreSQL.
  • Request optimization tips, for example, Suggest indexes or filters to improve this query.
  • Ask the Assistant to join tables or pivot results into the format your dashboard needs.

Apply results

Put the SQL to work in dashboards or correlations and ensure the output aligns with your expectations.

  • Add the generated query to a dashboard panel or Explore view.
  • Ask the Assistant to correlate the SQL findings with metrics or logs to connect business impact and system behavior.
  • Correct any misaligned columns or joins politely and restate the expected output before running the query again.

Share the SQL insights

You now have vetted SQL queries and summarized findings you can share with product owners, SREs, or analysts. Store the output alongside your incident notes or dashboards for future reference.

Troubleshooting

  • No tables returned: provide more specific keywords or schema hints.
  • Timeouts: ask for pagination or aggregate data instead of querying raw rows.
  • Unsupported SQL functions: clarify the database engine (PostgreSQL, MySQL, BigQuery) so the Assistant uses compatible syntax.
  • Moving on to a different dataset: start a new conversation so the Assistant does not mix table metadata between environments.

Next steps