SnowConvert AI - Best practices¶
1.提取¶
我们强烈建议您使用我们的脚本来提取工作负载:
- Teradata: DDL Export Scripts for Teradata (https://github.com/Snowflake-Labs/SC.DDLExportScripts/blob/main/Teradata/README.md).
- Oracle: DDL Export Scripts for Oracle (https://github.com/Snowflake-Labs/SC.DDLExportScripts/blob/main/Oracle/README.md).
- SQLServer: DDL Export Scripts for SQL Server (https://github.com/Snowflake-Labs/SC.DDLExportScripts/blob/main/SQLServer/README.pdf).
- Redshift: Redshift code extraction guide.
2.预处理¶
我们强烈建议您使用预处理脚本,该脚本旨在在开始评估或转化之前为您提供更好的结果。此脚本执行以下任务:
- 为每个顶级对象创建单个文件
- 按定义的文件夹层次结构组织每个文件(默认为:数据库名称 -> 架构名称 -> 对象类型)
- 生成一份清单报告,提供有关工作负载中所有对象的信息。
2.1 下载¶
- Download the binary of the script for macOS (https://sctoolsartifacts.z5.web.core.windows.net/tools/extractorscope/standardize_sql_files) and make sure to follow the setup instructions in Step 2.3.
- Download the binary of the script for Windows (https://sctoolsartifacts.z5.web.core.windows.net/tools/extractorscope/standardize_sql_files.exe).
2.2 描述¶
运行脚本需要以下信息:
| 脚本实参 | 示例值 | 必填 | 使用量 |
|---|---|---|---|
| 输入文件夹 | /home/user/extracted_ddls | 是 | { -i | ifolder= } |
| 输出文件夹 | /home/user/processed_extracted_ddls | 是 | { -o | ofolder= } |
| 数据库名称 | sampleDataBase | 是 | { -d | dname= } |
| 数据库引擎 | Microsoft SQL Server | 是 | { -e | dengine= } |
| 输出文件夹结构 | 数据库名称、顶级对象类型和架构 | 否 | [ { -s | structure= } ] |
| 生成数据透视表 | 是 | 否 | [ -p ] |
Note
数据库引擎实参 (-e) 的支持值为:oracle、mssql 和 teradata
Note
The supported values for the output folder structure argument (-s) are: database_name, schema_name and top_level_object_name_type.
When specifying this argument, all the previous values need to be separated by a comma. For example: -s database_name,top_level_object_name_type,schema_name.
此参数是可选的,如果未指定,则默认结构如下:数据库名称、顶级对象类型和架构名称。
Note
数据透视表生成参数 (-p) 是可选的。
2.3 为 Mac 设置二进制¶
- Set the binary as an executable:
chmod +x standardize_sql_files - 通过执行以下命令来运行脚本:
./standardize_sql_files
- If this is the first time running the binary the following message will pop-up:
Click OK. - Open Settings -> Privacy & Security -> Click Allow Anyway
.png)
运行脚本
- 使用以下格式运行脚本:
- Mac format
./standardize_sql_files -i "input path" -o "output path" -d Workload1 -e teradata - Windows format
./standardize_sql_files.exe -i "input path" -o "output path" -d Workload1 -e teradata
- Mac format
- 如果成功执行脚本,将显示以下输出:
拆分过程已成功完成! \ 报告已成功创建! \ 脚本已成功执行!