1. The origin story

In our day-to-day consulting work at Capgemini, engineers constantly encounter situations where they need to quickly convert an SQL query, a stored procedure, or a view from one dialect to Snowflake. Maybe it’s during a client workshop where someone asks, “how would this Oracle procedure look in Snowflake?” That’s the same situation I was in during an RFP discussion call for a leading US bank. Maybe it’s a developer or a migration team that needs to convert a single complex T-SQL query to validate an approach. Or maybe it’s a pre-sales demo where you need to show SQL conversion capability live, on the spot.

These aren’t large-scale migration scenarios – they’re quick, ad hoc needs that arise dozens of times a week across teams. Each one involves dialect idiosyncrasies like T-SQL IDENTITY columns, TRY/CATCH error handling, Oracle’s CONNECT BY, or Teradata’s QUALIFY – small but tricky differences that eat up time.

The uncomfortable truth: For ad hoc SQL conversion, engineers typically have two options: do it manually (slow and inconsistent – one person converts ISNULL() to IFNULL(), another uses NVL(), a third wraps it in a COALESCE()); or spin up an enterprise migration tool like SnowConvert AI (overkill for a single query, requires installation, project setup, and configuration). Neither option fits the reality of fast-paced consulting work.

We needed something in between – a lightweight, instant tool for quick SQL conversion. We needed an accelerator.

2. The idea: AI-powered ad hoc SQL conversion

The idea was simple: what if we could build a lightweight tool that takes any SQL dialect as input and produces Snowflake-compatible SQL as output – leveraging intelligent understanding of what the SQL is trying to accomplish rather than rigid rule-based transpilation, resulting in more natural, idiomatic Snowflake SQL that aligns with how engineers would write it natively? No installation, project setup, no bulk pipeline – just paste, click, convert.

Snowflake’s Cortex AI platform gave us exactly that capability. Using SNOWFLAKE.CORTEX.COMPLETE with a supported large language model (such as Claude 3.5 Sonnet or its successor, depending on availability at the time of use), we could send an SQL Server procedure along with detailed conversion instructions as a prompt and receive a restructured Snowflake equivalent – complete with explanations of what changed and why. That said, the output from Cortex AI may not be 100% accurate in every case – accuracy will vary depending on the complexity of the source SQL, the dialect-specific constructs involved, and the nuances of the conversion. Human review remains essential to validate and refine the results.

Who is this for?

The accelerator is designed for the everyday situations where engineers need quick, reliable SQL conversion:

  • Client workshops and demos – someone pastes an Oracle or T-SQL query and asks “how would this look in Snowflake?” You need an answer in seconds, not hours.
  • Pre-sales and RFP responses — demonstrate SQL conversion capability live during a pitch, with zero setup.
  • Developer self-service – a developer on a migration team quickly converts and validates a single procedure before committing to a pattern for the rest.
  • Ad hoc troubleshooting – a client shares a legacy query that’s failing after migration; you need to quickly see the correct Snowflake equivalent.
  • Learning and training — new engineers learning Snowflake SQL can see side-by-side diffs to understand dialect differences interactively.
  • Edge-case iteration – SnowConvert AI flags certain objects with errors or warnings; engineers use the accelerator to interactively fix and refine those specific objects.
  • Quick prototyping – during design sessions, quickly convert sample queries to validate that the Snowflake approach works before building the full pipeline.
  • Code review support – reviewing converted SQL and needing a quick “second opinion” conversion to compare approaches.

But a raw API call isn’t a product. We needed:

  • A visual interface where engineers could paste source SQL and see the conversion side-by-side
  • Diff highlighting to immediately spot every change
  • Conversion notes explaining each transformation for knowledge transfer
  • Support for multiple source dialects – not just SQL Server
  • A tool that was reusable across engagements, not a one-off script

This is where Cortex Code came in.

3. Building the accelerator with Cortex Code

Using Snowflake’s Cortex Code CLI, we described what we needed in a single prompt:

“Create a Streamlit application as an SQL Conversion Accelerator. Two side-by-side windows comparing SQL code – left panel for source SQL input with selectable source language (Oracle PL/SQL, SQL Server T-SQL, MySQL, PostgreSQL, Teradata, Redshift, DB2, Sybase), right panel for Snowflake-compatible converted SQL output. Highlight changes/diff between source and converted SQL. Power it with Snowflake Cortex AI (SNOWFLAKE.CORTEX.COMPLETE).”

Cortex Code didn’t just generate boilerplate. It produced a functional Streamlit application with:

  • Snowflake PAT-based OAuth authentication with connection caching
  • Accelerator-defined dialect support with pre-loaded sample SQL for each
  • Unified diff rendering using difflib with color-coded HTML output
  • Session state management for conversion history across reruns
  • Snowflake-branded theme (config.toml with official color palette)
  • Detailed conversion prompt engineering with structured JSON output driven by prompt instruction

4. Architecture

Architecture diagram using SVG

Data flow diagram

5. How it works

What you’re seeing: The engineer selects “Oracle PL/SQL” as the source dialect, pastes the procedure, and clicks Convert. Cortex AI returns the Snowflake SQL along with a list of conversion notes – all in a single click, with no setup or configuration required.

The left panel shows the original Oracle procedure using NVL, DBMS_OUTPUT, and Oracle’s EXCEPTION handling. The right panel shows the Snowflake-compatible equivalent using Snowflake Scripting, with every change highlighted in the diff view below. The conversion notes explain each transformation, making it easy for engineers to understand and validate the output.

Here’s a real conversion of an Oracle PL/SQL stored procedure to Snowflake SQL, completed in under five seconds:

The accelerator in action

How it works: Under the hood

5.1 The conversion prompt

The core of the accelerator is a carefully engineered prompt that tells Cortex AI exactly how to convert SQL. This isn’t a generic “convert this SQL” request – it includes:

  • Dialect-specific conversion rules (e.g., T-SQL IDENTITY → Snowflake IDENTITY, AUTOINCREMENT)
  • Data type mapping tables (e.g., NVARCHAR(MAX)VARCHAR, DATETIME2TIMESTAMP_NTZ)
  • Structural transformations (e.g., T-SQL TRY/CATCH → Snowflake EXCEPTION blocks)
  • JSON output schema for structured, parseable responses

SELECT SNOWFLAKE.CORTEX.COMPLETE(
  ‘claude-3-5-sonnet’,
  ‘You are a SQL conversion expert. Convert the following
   SQL Server T-SQL code to Snowflake-compatible SQL.

   Return a JSON object with:
   – “converted_sql”: the Snowflake SQL
   – “notes”: array of conversion notes explaining changes

   Source SQL:
   CREATE PROCEDURE dbo.UpdateInventory …
  ‘
) AS result;

5.2 Side-by-side comparison

The Streamlit UI uses a two-column layout. The left column contains a text area for source SQL input with a dialect selector. The right column displays the converted Snowflake SQL with syntax highlighting. Below both columns, a unified diff view highlights every change in red (removed) and green (added).

5.3 Diff engine

We use Python’s difflib.unified_diff to generate line-by-line comparisons, rendered as styled HTML directly in the Streamlit app. This gives engineers immediate visual confirmation of what changed.

5.4 Session management

Every conversion is stored in Streamlit’s session state, building a conversion history that persists across reruns. Engineers can review past conversions without re-running them.

6. Supported source dialects

Source dialectKey conversionsComplexity
SQL Server T-SQLIDENTITY, TRY/CATCH, MERGE with OUTPUT, temp tables, STRING_AGGHigh
Oracle PL/SQLSEQUENCES, packages, ROWNUM, CONNECT BY, NVL2, DECODEHigh
MySQLAUTO_INCREMENT, LIMIT, backtick quoting, IFNULL, GROUP_CONCATMedium
PostgreSQLSERIAL, RETURNING, array types, generate_seriesMedium
TeradataQUALIFY, SAMPLE, SEL/FROM, date arithmetic, COLLECT STATSHigh
Amazon RedshiftDISTKEY/SORTKEY, COPY, UNLOAD, LISTAGG, GETDATE()Medium
IBM Db2FETCH FIRST, VALUES, CONCAT operator, GRAPHIC typesMedium
SybaseSimilar to early SQL Server, COMPUTE, PRINT, RAISERRORMedium

7. Business value

Key impact metrics (based on internal testing across representative-stored procedures and queries).

  • Significant reduction in per-procedure conversion effort in our experience. What previously took hours of manual work can often be completed in minutes.
  • More consistent output – the same prompt-driven patterns are applied across conversions, reducing variability compared to manual approaches.
  • Knowledge transfer built-in conversion notes accompany each output, helping engineers learn Snowflake patterns as they work.
  • A single multi-dialect tool covers eight source platforms, addressing the majority of enterprise database dialects.

For day-to-day consulting

The accelerator directly addresses the gap between manual conversion and enterprise migration tools. Instead of spending 30 minutes to an hour manually converting a single query during a client call, engineers get an accurate conversion in seconds – with built-in conversion notes that double as learning material for the team.

For Capgemini at scale

This is not a one-off tool. We built it as a reusable accelerator that can be deployed for any customer migration across Capgemini:

  • Any account team can use it immediately – no specialized setup required.
  • Supports eight source dialects, covering the vast majority of enterprise databases.
  • The Streamlit interface requires zero training – just paste SQL, and click convert.
  • Runs on Snowflake’s own infrastructure – no external API costs or data residency concerns.
  • Can be extended with customer-specific conversion rules via prompt customization.

8. Technology stack

Tech stack diagram

9. Where this fits: Complementing SnowConvert AI

Snowflake offers SnowConvert AI, a powerful enterprise migration platform designed for large-scale, automated SQL conversion projects. A natural question arises: if SnowConvert AI exists, why build a separate accelerator?

The accelerator as a companion to SnowConvert AI

The two tools work best together. A typical workflow in a migration engagement:

  1. SnowConvert AI runs the bulk conversion, processing thousands of objects and generating EWI reports.
  2. Engineers review the EWI report to identify objects that failed or partially converted.
  3. SQL Conversion Accelerator is used to interactively fix those flagged objects one by one, with diff views and conversion notes guiding the resolution.
  4. During client workshops, the accelerator provides live demos and handles ad hoc conversion requests on the spot.
  5. New team members use the accelerator’s side-by-side diff and notes as a learning tool to understand Snowflake SQL patterns.

Key insight: SQL Conversion Accelerator complements SnowConvert AI. While SnowConvert AI handles the heavy lifting of bulk migration, the accelerator fills the gaps: resolving EWI-flagged objects, enabling live demos, supporting ad hoc conversion during client calls, and providing an interactive learning tool for engineers new to Snowflake SQL.

10. Lessons learned

Prompt engineering matters

The quality of SQL conversion is directly proportional to the quality of the prompt. Generic prompts like “convert this SQL” produce mediocre results. Our prompt includes dialect-specific rules, data type mappings, and a structured JSON output schema. This is the difference between a demo and a production tool.

Cortex Code as a development accelerator

Using Cortex Code to build the application itself was a meta-acceleration: we used an AI tool to build an AI-powered tool. The entire Streamlit application was developed in just a few sessions. This included solving real-world issues like Streamlit API compatibility, authentication flow design, and connection caching.

AI conversion is not a replacement for review

The accelerator dramatically reduces conversion time, but human review remains essential. The diff view and conversion notes are designed to make that review fast and informed. This is an accelerator, not an autopilot.

11. What’s next

  • Batch mode – upload a folder of SQL files and convert them all at once
  • Validation engine – run converted SQL against Snowflake to catch syntax errors before delivery
  • Custom rule injection – allow teams to add client-specific conversion rules
  • Conversion report generation – export a summary of all conversions with statistics
  • Integration with SnowConvert AI – feed SnowConvert AI assessment reports into the accelerator to prioritize ad hoc conversions and handle edge cases flagged during bulk migration
  • Deploy to Snowflake – run the Streamlit app natively within Snowflake for zero-infrastructure access

Conclusion

The SQL Conversion Accelerator started with a simple frustration – the gap between needing a quick SQL conversion and having a tool light enough to deliver one. It grew into a reusable asset for Capgemini’s entire Snowflake practice: a lightweight companion to SnowConvert AI that handles the ad hoc, interactive, and demo-ready conversions that enterprise migration tools are not designed for. By combining Snowflake Cortex AI’s language understanding with a clean Streamlit interface and thoughtful prompt engineering, we turned a manual, error-prone process into an intelligent, consistent, and fast workflow.

The tool itself was built using Cortex Code – a testament to how AI-assisted development can compound: we used AI to build an AI-powered tool, and both layers delivered real acceleration.

Get started: The SQL Conversion Accelerator is available as a reusable Streamlit application. Contact the Snowflake Practice team at Capgemini for access and deployment guidance.