SnowConvert AI - Azure Synapse¶
What is SnowConvert AI for Azure Synapse?¶
SnowConvert AI is a software that understands Azure Synapse scripts and converts this source code into functionally equivalent Snowflake code.
转换类型¶
Specifically, SnowConvert AI for Azure Synapse performs the following conversions:
Azure Snapse 转换为 Snowflake SQL¶
SnowConvert AI understands the Azure Synapse 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.
示例代码¶
Azure Synapse 基本输入代码:
CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
Snowflake SQL 输出代码:
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":"azure synapse"}}'
;
如您所见,大多数结构保持不变。例如,在某些情况下,必须转换数据类型。
Azure Synapse 存储过程转换为嵌入 Snowflake SQL 中的 JavaScript¶
SnowConvert AI takes Azure Synapse stored procedures and converts them to JavaScript embedded into Snowflake SQL. Azure Synapse'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.
示例代码¶
Azure Synapse 基本存储过程:
CREATE PROCEDURE SelectAllCustomers
AS
SELECT * FROM Customers
GO;
包含嵌入式 JavaScript 的 Snowflake SQL 输出代码:
-- 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`);
$$;
;
创建 JavaScript 代码时,会将一部分代码添加为 辅助函数,以便于转换存储过程的内容。
您可以看到带有关联代码的警告,帮助您了解转换后的代码中发生了什么。(请参阅 问题和故障排除)
SnowConvert AI Terminology¶
为了确保我们在深入探讨代码转换的奇妙之处之前达成共识,以下是一些关键术语的定义说明,这样当我们在文档中频繁使用这些术语时,您能准确理解它们的含义:
SQL(结构化查询语言): 大多数现代数据库架构中用于存储、操作和检索数据的标准语言。
SnowConvert AI: the software that converts securely and automatically your Azure Synapse 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.