SnowConvert AI - Teradata - MLOAD¶
Teradata MLOAD ファイルをPythonに変換するための翻訳リファレンス
Teradata MultiLoad は、Teradataデータベースの複数のテーブルとビューを高速かつ大量にメンテナンスするためのコマンド駆動型ユーティリティです。
To simulate the MultiLoad functionality for Teradata in Snowflake, MultiLoad files and commands are transformed to Python code, similar to the transformations performed for BTEQ and FastLoad scripts. The generated code uses the Snowflake Python project called snowconvert.helpers which contains the required functions to simulate the MultiLoad statements in Snowflake.
MultiLoad コマンド翻訳¶
MultiLoad コマンド のほとんどはSnowflakeでは関係ないと考えられているため、これらのコマンドはコメントアウトされています。以下は、MultiLoad コマンドの概要リストとSnowflakeへの変換ステータスです。
| Commands | Transformation Status | Note |
|---|---|---|
| ACCEPT | Commented | |
| BEGIN MLOAD | Transformed | The node is commented out since the transformation occurs in other related statements instead. |
| BEGIN DELETE MLOAD | Commented | |
| DATEFORM | Commented | |
| DELETE | Partially transformed | Check known issues. |
| DISPLAY | Commented | |
| DML LABEL | Transformed | |
| END MLOAD | Transformed | Commented out since is not necessary for the transformation of the BEGIN MLOAD. |
| EOC | Commented | |
| FIELD | Transformed | |
| FILLER | Transformed | This command needs to be with a FIELD and LAYOUT command to be converted. |
| IF, ELSE, and ENDIF | Commented | |
| IMPORT | Transformed | |
| INSERT | Transformed | This is taken as a Teradata Statement, so it doesn't appear in this chapter. |
| LAYOUT | Transformed | This command needs to be with a FIELD and FILLER command to be converted. |
| LOGDATA | Commented | |
| LOGMECH | Commented | |
| LOGOFF | Commented | |
| LOGON | Commented | |
| LOGTABLE | Commented | |
| PAUSE ACQUISITION | Commented | |
| RELEASE MLOAD | Commented | |
| ROUTE MESSAGES | Commented | |
| RUN FILE | Commented | |
| SET | Commented | |
| SYSTEM | Commented | |
| TABLE | Commented | |
| UPDATE | Transformed | This is taken as a Teradata Statement, so it doesn't appear in this chapter. |
| VERSION | Commented | |
しかし、いくつかの例外的なコマンドは、Snowflakeで意図したとおりに動作させるためにPython固有のコードに変換する必要があります。この セクションをご覧ください。
この文書に関してご質問がある場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)まで電子メールをお送りください。
BEGIN MLOAD¶
コマンド .BEGIN MLOAD の変換は、その動作を正しくシミュレートするために、 .LAYOUT、 .FIELD、 .FILLER、 .DML LABEL、および .IMPORT コマンドを必要とするマルチパートの変換です。
この変換については、以下のサブセクションで詳しく説明します。
.LAYOUT、.FIELD および.FILLER¶
.LAYOUT、 .FIELD、 .FILLER のコマンドの変換は、このレイアウトの IMPORT の将来の関数呼び出しで使用される変数定義を作成します。
Teradata(MultiLoad)
Snowflake(Python)
.DML LABEL¶
.DML LABEL コマンドの変換は、ラベル定義の後にステートメントを含む関数を作成します。.DML LABEL コマンドの後には通常、 Insert、 Update、または Delete があることに注意してください。
Teradata(MultiLoad)
Snowflake(Python)
.IMPORT¶
.IMPORT コマンドの変換により、import_file_to_temptable ヘルパーの呼び出しが作成され、ファイルから仮テーブルにデータの読み込みが行われます。その後、元のインポートで使用されたすべての APPLY ラベルへの呼び出しが作成されます。最後に、INSERT ラベルの呼び出しは、クエリパラメーターに変換され、オプションでクエリ条件を持つことができます。
Teradata(MultiLoad)
Snowflake(Python)
大容量の例¶
上に示した様々なコマンドの変換を踏まえて、次の例を考えてみましょう。
この入力データで:
Teradata(MultiLoad)
クエリ
結果
| ROW | ID | NAME | AGE |
|---|---|---|---|
| 1 | NULL | ohn | 25 |
| 2 | 2 | aria | 29 |
| 3 | 3 | arlos | 31 |
| 4 | 4 | ike | 40 |
| 5 | 5 | aura | 27 |
Snowflake(Python)
クエリ
結果
| ROW | ID | NAME | AGE |
|---|---|---|---|
| 1 | NULL | ohn | 25 |
| 2 | 2 | aria | 29 |
| 3 | 3 | arlos | 31 |
| 4 | 4 | ike | 40 |
| 5 | 5 | aura | 27 |
既知の問題¶
1.Deleteステートメントは部分的にサポートされています
LAYOUT で定義された列を指している場合、where条件が見つかると正しく変換されないため、DELETE ステートメントは部分的にサポートされています。
In the example below, :EmpNo is pointing to a LAYOUT defined column. However, the transformation does not take this into account and thus the code will be referencing a column that does not exist.
この文書に関してご質問がある場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)まで電子メールをお送りください。