Skip to content
Notifications
Clear all

Step-by-step: Connecting Gemini to our Snowflake data warehouse for custom reports.

2 Posts
2 Users
0 Reactions
0 Views
(@eval_engineer_101)
Estimable Member
Joined: 1 week ago
Posts: 87
Topic starter   [#8025]

Hi everyone. I'm deep into evaluating Gemini for our analytics team, and the main use case we're exploring is generating custom reports from our Snowflake data warehouse. We have a lot of ad-hoc "what if" questions from stakeholders, and writing SQL for every single one is a bottleneck.

I've managed to get a basic connection working, but I'm now trying to map out a real-world workflow and I have a lot of questions for those who've done this already.

Here's my current, very manual step-by-step:

1. **Credentials & Connection:** I set up a dedicated service account in GCP, granted it BigQuery permissions (since that's the bridge?), and used the Snowflake Connector for Python in a Colab notebook to pull specific table schemas.
2. **Schema Context:** I manually paste these schema details (table names, column names, data types) into my Gemini prompt to give it context.
3. **Prompting:** I then ask my natural language question, like "Show me monthly sales by region for product line X, excluding test accounts."
4. **Validation:** Gemini returns SQL, which I then have to manually run in Snowflake to check the output.

This works in a sandbox, but it feels clunky and not scalable for the team.

My main questions for the community are:

* **How does this compare to using a dedicated BI tool's NLQ feature?** (e.g., ThoughtSpot, Looker's "Explore with AI"). Is the main advantage here Gemini's flexibility in report *formatting* and narrative?
* **Integration Workflow:** For a production-like flow, are you:
* Building a simple web interface that talks to both?
* Using the Gemini API to automate step 2 & 3, feeding it schema updates periodically?
* Storing validated "good" prompts somewhere as reusable templates?
* **Pricing Gotchas:** With the Gemini API, is the cost primarily in the input tokens from sending large schema definitions repeatedly? Have you found a way to manage that context efficiently?
* **Accuracy & Safety:** How are you handling SQL validation? Are you using a sandboxed, read-only Snowflake user for the generated queries? Any major pitfalls with joins or aggregation logic?

I'm particularly interested in any middleware or pattern that sits between the user's question and Snowflake to add that layer of governance. We're coming from a Tableau/Manual SQL background, so moving to an AI-generated SQL model requires a lot of trust.



   
Quote
(@ericd)
Reputable Member
Joined: 1 week ago
Posts: 180
 

It's smart that you're already feeling the friction in that workflow. Manually pasting schemas and validating every SQL output is going to fall apart at scale.

You mentioned a "dedicated service account in GCP"... are you actually using BigQuery as a bridge? That feels like an extra, possibly unnecessary, hop if you've already got the Snowflake Connector working. I'd look at ways to directly provide schema context to Gemini via the API or a maintained context document, rather than pasting it into each chat. The manual validation step is also a huge bottleneck; you'll probably need to build some lightweight automated checks into the process before a human even looks at it.

Have you explored setting up a dedicated chat session or "project" within Gemini where the core schema context is pre-loaded and persistent? That would cut out a lot of the copy-paste.


Keep it civil, keep it real.


   
ReplyQuote