AI powered code conversion

AI code conversion (or AI-powered code conversion) strengthens the migration process by using AI agents to convert more objects through automated functional validation of converted database code. It uses synthetic data generation, AI-driven unit testing, and AI-driven resolution of errors identified in the deterministic code conversion step, where error warnings and issues (EWIs) and functional difference messages (FDMs) flag conversion issues—along with an intelligent layer in the Snowflake Service that proactively converts code, verifies correctness, resolves errors, and accelerates confidence.

During migration, deterministic logic is first used to translate the source code, surfacing EWIs and FDMs when it cannot automatically resolve certain patterns. Then, AI code conversion is used to reduce manual remediation effort, identify and resolve issues earlier in the process, and provide assurance to users that the converted objects behave as expected.

Key features of AI code conversion

  • Validação por AI acelerada: Reduza drasticamente o tempo e os recursos gastos em testes manuais.

  • Geração automatizada de testes: O agente gera automaticamente casos de teste com base nas consultas existentes e na lógica de negócios.

  • Sugestões de reparo do agente**: O agente sugere correções para seu código existente para produzir resultados consistentes entre seu sistema legado e o Snowflake.

Prerequisites for AI code conversion

Before you get started with AI code conversion, complete the following steps:

  1. Baixe e instale o SnowConvert AI.

  2. [Recomendado] Converta seu código legado do SQL Server usando o SnowConvert AI.

  3. Conecte uma conta designada especificamente para testes e desenvolvimento e evite usar uma conta de produção.

    Some objects will be created as part of the AI code conversion process.

  4. Certifique-se de que a função PUBLIC na conta que você conectar não tenha acesso a nenhum dado de produção e não tenha privilégios para executar nenhuma operação sensível, como comandos CREATE USER.

  5. Ensure that the role used for AI code conversion has the following privileges on the account:

    • CREATE DATABASE

    • CREATE MIGRATION

  6. Habilite as funções Cortex AI SQL na conta, especificamente para o modelo claude-4-sonnet.

Getting started with AI code conversion

Para iniciar um projeto de validação de migração, conclua as seguintes etapas:

  1. Execute the code conversion of SnowConvert AI on your SQL Server database.

  2. After the code conversion is complete, select GO TO AI code conversion from the Results page.

    (i) Todo o processamento de AI ocorre na conta Snowflake à qual você se conecta e consome os custos do Snowflake.

  3. You will be redirected to the Connect to Snowflake page to enter the connection parameters of a testing account. This is necessary to ensure that the AI code conversion process creates objects and executes queries in the test database and avoids unintended changes to the production database. Select Continue.

  4. Acknowledge and confirm the AI disclaimers and select Continue.

  5. The Select objects page displays the current conversion status of each database object under the Conversion column. Select the required objects for AI code conversion. You can also run an AI code conversion process with source-system verification by selecting Upload custom instructions.

    O SnowConvert executa automaticamente as seguintes ações:

    1. Seleciona e valida automaticamente os objetos dependentes quando associados aos objetos escolhidos.

    2. Revisa um resumo dos objetos selecionados e das dependências deles, bem como o tempo estimado e o custo de crédito do Snowflake.

    3. Confirms the selection to proceed with code conversion.

  6. Select AI Convert. SnowConvert AI connects to your Snowflake account, where it relies on Cortex AI Functions to review your code and suggest resolutions to any problems. AI code conversion might take a few minutes to start, and it might run for several minutes or hours depending on the complexity of the code being verified.

  7. The AI Results page shows the status for the AI code conversion of selected objects. The Status column indicates the AI code conversion outcomes. Select Details to review the test code and test results, source code, and converted code.

    (i) Revise o código gerado por AI antes de implantá-lo. O código gerado por AI pode não estar correto.

    • Status of the AI code conversion:

      • Corrigido com AI

      • Não foi possível verificar

      • Verificado

      • Erro no objeto original

    • OPEN CODE:

      • By default, this option opens and compares your original source code and the code generated by the AI code conversion process in VS Code.

      • Se você clicar na seta ao lado de OPEN CODE, também terá a opção de abrir e comparar no VS Code:

        • The converted code from SnowConvert and the code converted by AI.

  8. Select VERIFIED BY USER for all objects for which you have accepted the AI code conversion. Only objects that are verified by the user can be deployed.

Billing and cost considerations with SnowConvert AI code conversion

AI code conversion consumes Snowflake credits based on the compute resources it uses in your Snowflake account. The following features contribute to the cost:

  • AI SQL - AI code conversion uses Cortex AI SQL.

  • Warehouse \– as consultas de teste são executadas em um warehouse.

  • Snowflake stages - Input and outputs for AI code conversion are stored in a stage, which incurs storage costs.

  • SPCS - AI code conversion might consume a small amount of credits to use Snowpark Container Services. To find the costs associated with AI code conversion, look for compute pools with names that start with AI_MIGRATOR. For more information, see Snowpark Container Services costs.

Para obter mais informações, consulte Tabela de consumo de serviços do Snowflake.

Limitations of AI powered code conversion

The initial version is optimized for standard SQL Server migrations. While migration process can handle many query types, all the changes generated by SnowConvert AI code conversion must be reviewed by the customer before they can be deployed to any account.