SnowConvert AI - SQL Server

What is SnowConvert AI for SQL Server?

SnowConvert AI is a software that understands SQL Server scripts and converts this source code into functionally equivalent Snowflake code.

Konvertierungstypen

Specifically, SnowConvert AI for SQL Server performs the following conversions:

SQL Server in Snowflake SQL

SnowConvert AI understands the SQL Server source code and converts the Data Definition Language (DDL), Data Manipulation Language (DML), and functions in the source code to the corresponding SQL in the target: Snowflake.

Beispielcode

Grundlegender SQL Server-Eingabecode:

CREATE TABLE Persons (
    PersonID int,
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255)
);
Copy

Snowflake-SQL-Ausgabecode:

CREATE OR REPLACE TABLE Persons (
    PersonID INT,
    LastName VARCHAR(255),
    FirstName VARCHAR(255),
    Address VARCHAR(255),
    City VARCHAR(255)
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
;
Copy

Wie Sie sehen können, bleibt die Struktur größtenteils gleich. Es gibt einige Fälle, in denen die Datentypen umgewandelt werden müssen, zum Beispiel:

Gespeicherte SQL Server-Prozeduren in JavaScript, das in Snowflake SQL eingebettet ist

SnowConvert AI takes SQL Server stored procedures and converts them to JavaScript embedded into Snowflake SQL. SQL Server’s CREATE PROCEDURE is replaced by Snowflake’s CREATE OR REPLACE PROCEDURE. JavaScript is called as a scripting language, and all of the inner statements are converted to JavaScript.

Beispielcode

Grundlegende gespeicherte SQL Server-Prozedur:

CREATE PROCEDURE SelectAllCustomers
AS
SELECT * FROM Customers
GO;
Copy

Snowflake-SQL-Ausgabecode, mit eingebettetem JavaScript:

-- Additional Params: -t JavaScript
CREATE OR REPLACE PROCEDURE SelectAllCustomers ()
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
   // REGION SnowConvert AI Helpers Code
   // END REGION

EXEC(`SELECT
   *
FROM
   Customers`);
$$;

!!!RESOLVE EWI!!! /*** SSC-EWI-0040 - THE STATEMENT IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
;
Copy
  • Bei der Erstellung des JavaScript-Codes wird ein Teil des Codes als helper hinzugefügt, der für eine einfachere Umwandlung des Inhalts der Prozedur erforderlich ist.

  • Sie können damit rechnen, dass Warnungen mit einem zugehörigen Code angezeigt werden, damit Sie herausfinden können, was im konvertierten Code passiert. (Siehe Probleme und Problembehandlung)

SnowConvert AI Terminology

Bevor wir uns in der Magie dieser Codekonvertierungen verlieren, hier ein paar Begriffe/Definitionen, damit Sie wissen, was wir meinen, wenn wir sie in der gesamten Dokumentation verwenden:

  • SQL (Structured Query Language):_ Die Standardsprache zum Speichern, Bearbeiten und Abfragen von Daten in den meisten modernen Datenbankarchitekturen.

  • SnowConvert AI: the software that converts securely and automatically your SQL Server files to the Snowflake cloud data platform.

  • Conversion rule or transformation rule: rules that allow SnowConvert AI to convert from a portion of source code to the expected target code.

  • Parse: parse or parsing is an initial process done by SnowConvert AI to understand the source code and build up an internal data structure required for executing the conversion rules.

On the next few pages, you’ll learn more about the kind of conversions that SnowConvert AI for SQL Server is capable of. If you’re ready to get started, visit the Getting Started page in this documentation.