SnowConvert AI - BigQuery 問題¶
注釈
変換範囲
SnowConvert AI for Google BigQuery は現在、TABLES とVIEWS の評価と変換をサポートしています。SnowConvert AI は他のタイプのステートメントも認識できますが、完全にはサポートしていません。
このページでは、 SnowConvert AI がGoogle BigQuery の文法要素をSnowflakeの同等要素に変換する方法について包括的なリファレンスを提供します。この変換リファレンスでは、コード例、機能的同等性の結果、主な相違点、推奨事項、既知の問題、および各変換の説明をご覧いただけます。
SSC-EWI-BQ0001¶
Snowflakeはオプション句をサポートしていません。
警告
この EWI は非推奨です。この EWI の最新バージョンについては、[SSC-EWI-0016]( generalEWI.md#ssc-ewi-0016)をご参照ください。
重大度¶
中
説明¶
この EWI は、 OPTIONS にSnowflakeがサポートしていないオプションがある場合に、 DDL ステートメントに追加されます。
コード例 ¶
入力コード:
BigQuery¶
出力コード:
Snowflake¶
推奨事項 ¶
変換されていない式に手動で変更を加えます。
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0002¶
すべてのSnowflakeテーブルでマイクロパーティションが自動的に実行されます。
注釈
この問題は非推奨となり、 SnowConvert AI によって生成されなくなりました。
重大性¶
Medium
説明¶
この警告は、partition by句が存在する場合にCreate tableに追加されます。PARTITION BY は、[テーブルパーティショニング](https://cloud.google.com/bigquery/docs/partitioned-tables)を制御するオプションの句ですが、Snowflakeではサポートされていません。
Snowflakeテーブル内のすべてのデータは、連続したストレージ単位であるマイクロパーティションに自動的に分割されます。各マイクロパーティションには、50 MB から500 MB の非圧縮データが含まれます。このサイズと構造により、非常に大きなテーブルの非常にきめ細かなプルーニングが可能になります。これは数百万、または数億のマイクロパーティションで構成することができます。
Snowflakeは、以下を含む、マイクロパーティションに保存されているすべての行に関するメタデータを保存します:
マイクロパーティションの各列の値の範囲。
個別の値の数。
最適化と効率的なクエリ処理の両方に使用される追加のプロパティ。
また、テーブルは、挿入/ロードされるデータの順序を使用して透過的にパーティション分割されます。詳細については、[マイクロパーティショニングのメリット](https://docs.snowflake.com/en/user-guide/tables-clustering-micropartitions#benefits-of-micro-partitioninghttps://docs.snowflake.com/en/user-guide/tables-clustering-micropartitions#benefits-of-micro-partitioning)をご参照ください。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
ユーザーによる追加の操作は必要なく、ただ情報を提供するだけです。
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0003¶
Pending SnowConvert AI translation for differential privacy.
重大性¶
中
説明¶
BigQuery allows applying differential privacy over some statistical functions to introduce noise in the data, making it difficult to extract information about individuals when analyzing query results.
Snowflake now supports differential privacy natively. However, SnowConvert AI has not yet implemented the translation for this feature. Any use of differential privacy in BigQuery will be commented out and this issue will be generated to flag the need for manual conversion.
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Use native Snowflake support: Snowflake now supports differential privacy natively. Rewrite the BigQuery differential privacy syntax using Snowflake's privacy policies and privacy budgets.
Key differences: Snowflake's differential privacy implementation uses privacy policies assigned to tables/views, privacy budgets to manage analyst queries, and privacy domains for fact and dimension columns. The syntax differs from BigQuery's inline
WITH DIFFERENTIAL_PRIVACYclause.Further reading: Snowflake Differential Privacy Overview
SSC-EWI-BQ0004¶
Snowflakeは名前付きウィンドウをサポートしていません。
重大性¶
中
説明¶
BigQuery を使用すると、集計関数での名前付きウィンドウの定義と使用が可能になります。名前付きウィンドウは、使用されるクエリの WINDOW 句で定義され、これらの関数の OVER 句内で使用できます。
Snowflakeは名前付きウィンドウの宣言をサポートしていません。ウィンドウの定義を取得し、関数の OVER 句でそのウィンドウのすべての使用法に直接適用することを検討してください。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
名前付きウィンドウの定義を確認します。その定義を取得して、それが使用されている関数の
OVER句に適用できる可能性があります。しかし、 BigQuery とSnowflakeウィンドウフレームの機能の違いは引き続き適用されることに注意してください。次のケースを例に挙げます。
BigQuery:
Snowflake:
これらの2つのクエリは同じ行を生成しますが、Snowflakeの結果は順序付けされません。これは、ウィンドウフレームの ORDER BY 句が、 BigQuery のようにクエリ全体の順序付けに**影響しないためです。
SSC-EWI-BQ0005¶
Javascript code has not been validated by SnowConvert AI.
重大性¶
高
説明¶
SnowConvert AI はJavascriptコードを変換しません。BigQuery の関数から抽出されたJavascriptのコードはまったく変更されていないので、このコードをSnowflakeで動作させるには若干の調整が必要になる可能性があります。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
デプロイ前にすべてのJavascriptコードを確認します。
SnowflakeのJavascriptパラメーターは大文字にする必要があります。
For more information, visit Snowflake's Introduction to Javascript UDFs.
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0006¶
ST_GEOGFROMTEXT 関数の指向パラメーターはSnowflakeではサポートされていません。
重大性¶
低
説明¶
この警告は、[ST_GEOGFROMTEXT](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_geogfromtext)関数で指向パラメーターが指定されている場合に追加されます。これは、Snowflakeではサポートされていないためです。このパラメーターが TRUE に設定されている場合、入力内のポリゴンは次のような方向を向いていると想定されます。誰かが入力頂点の順序でポリゴンの境界に沿って歩くと、ポリゴンの内部は左側になります。これにより、 WKT は半球よりも大きなポリゴンを表現できるようになります。oriented が FALSE または省略されている場合、この関数は面積が最小のポリゴンを返します。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Review polygon orientation: If the
orientedparameter was set toTRUE, verify that the polygon does not span more than a hemisphere. Snowflake'sST_GEOGFROMTEXTalways returns the polygon with the smallest area.Manual validation: For polygons larger than a hemisphere, consider splitting them into smaller polygons or using alternative geospatial representations.
Remove the parameter: After manual review, remove the
orientedparameter from the function call, as Snowflake'sST_GEOGFROMTEXTaccepts only the WKT string argument.
SSC-EWI-BQ0007¶
エスケープシーケンスはSnowflakeでは無効です。
重大性¶
低
説明¶
ベル文字(\a)と垂直文字(\v)は、 BigQuery では有効なエスケープシーケンスですが、Snowflakeでは有効ではありません。
This warning is added when a bell character or vertical character escape sequence is found when translating BigQuery code. For more information, see BigQuery Escape Sequences.
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Replace with Unicode escapes: Replace
\a(bell character, U+0007) with\x07and\v(vertical tab, U+000B) with\x0B, which are supported by Snowflake.Review usage: If the escape sequence was used for formatting purposes, consider whether it is still needed in the Snowflake context.
SSC-EWI-BQ0008¶
8桁の16進数によるUnicodeエスケープシーケンスはSnowflakeではサポートされていません。
重大性¶
低
説明¶
BigQuery は8桁の16進数によるUnicodeシーケンスをサポートしています。Snowflakeはこの種のUnicodeシーケンスをサポートしていません。
この警告は、 BigQuery コードの変換時に8桁の16進数によるUnicodeシーケンスが見つかった場合に追加されます。[BigQuery エスケープシーケンス](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#escape_sequences)の詳細。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Use surrogate pairs: Convert the 8-hex-digit Unicode sequence into two 4-hex-digit surrogate pair sequences. For example,
\U00100000can be represented using surrogate pairs\uDBC0\uDC00.Use CHR function: Alternatively, use Snowflake's
CHRfunction with the Unicode code point to generate the character at runtime.
SSC-EWI-BQ0009¶
SnowConvert AI was unable to generate the correct return table clause. Missing symbol information.
重大性¶
高
説明¶
Snowflakeでは、 CREATE TABLE FUNCTION ステートメントに有効な RETURNS TABLE 句が必要です。SnowConvert AI は、一から新しく構築する必要があります。これを行うには、結果のテーブルの列の型を適切に推論するために、 CREATE TABLE FUNCTION クエリに対して分析が行われます。しかし、シナリオによっては、 SnowConvert AI に現在 return 句を適切に構築できる制限がある場合があります。
これらのシナリオは将来的に検討される予定ですが、その間このエラーが追加されます。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Manually define the RETURNS TABLE clause: Inspect the original BigQuery TABLE FUNCTION body to determine the column names and types of the result set, then populate the empty
RETURNS TABLE()clause with the correct column definitions.Provide source references: If the issue is caused by missing references, ensure all referenced tables and views are included in the input provided to SnowConvert AI.
SSC-EWI-BQ0010¶
The resulting table has no columns
重大性¶
中
説明¶
This EWI is added when SnowConvert AI creates an external table whose definition has no columns. External tables in BigQuery can be defined using only OPTIONS (e.g., FORMAT and URIS) without explicit column definitions, relying on schema inference. When the resulting table structure has no columns after conversion, SnowConvert AI emits this EWI to flag that manual definition of the table schema may be required.
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Provide column definitions: If the source BigQuery external table uses inferred schema, manually add the expected column definitions to the generated Snowflake external table based on the actual file structure.
Use INFER_SCHEMA: Consider using Snowflake's INFER_SCHEMA function with a sample file path (without wildcards) to generate the table template.
Include table definitions: Ensure all referenced table or view definitions are included in the input provided to SnowConvert AI so that symbol information can be collected.
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0011¶
Snowflakeでは、複雑なデータ型のセッション変数への代入はサポートされていません。
重大性¶
中
説明¶
BigQuery では、スクリプトレベルで変数を宣言すると、スクリプト全体で使用できるようになり、Snowflakeでこの動作を再現するには[SQL 変数](https://docs.snowflake.com/en/sql-reference/session-variables)が使用されます。
しかし、 ARRAY 、 GEOGRAPHY 、 STRUCT 、 JSON のように複雑なデータ型の変数を宣言すると、SnowflakeではSQL 変数に値を設定しようとすると失敗します。SnowConvert AI がこのようなケースを検出すると、EWI がSQL の変数宣言に追加される。
これらの型の変数は、ブロックステートメントやその他の手続きステートメント内で問題なく宣言できます。この EWI は、スクリプトレベルで宣言された変数にのみ適用されます。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
変数の用途が1つのスコープに限定されていたり、その値が変更されることがない場合は、その変数を使用するスコープでローカルに宣言することを検討してください。これにより、問題は解決します。
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0012¶
SnowConvert AI was unable to generate a correct OBJECT_CONSTRUCT parameter. Missing symbol information.
重大性¶
高
説明¶
SnowConvert AI was unable to generate a correct OBJECT_CONSTRUCT parameter due to missing symbol information. This typically occurs when the table definition is not included in the input provided to SnowConvert AI, or when the table uses complex types (such as STRUCT) whose field names are needed to build the OBJECT_CONSTRUCT call.
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Provide table definitions: Ensure all referenced table definitions (CREATE TABLE statements) are included in the input provided to SnowConvert AI so that symbol information can be collected.
Manual replacement: Inspect the original BigQuery INSERT statement and manually construct the
OBJECT_CONSTRUCTcall with the correct field names and values matching the target table's schema.
SSC-EWI-BQ0013¶
snowflakeでサポートされていない外部テーブルデータ形式
警告
この EWI は非推奨です。この EWI の最新バージョンについては、[SSC-EWI-0029](generalEWI.md#ssc-ewi-0029))ご参照ください。
重大性¶
中
説明¶
Snowflakeは、次の BigQuery 形式をサポートしています。
BigQuery |
Snowflake |
|---|---|
AVRO |
AVRO |
CSV |
CSV |
NEWLINE_DELIMITED_JSON |
JSON |
ORC |
ORC |
PARQUET |
PARQUET |
When an external table has other FORMAT not specified in the above table, this EWI will be generated to inform the user that the FORMAT is not supported.
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0014¶
Hive partitioned external tables are not supported in Snowflake
重大性¶
中
説明¶
Snowflakeは、Hiveパーティション化された外部テーブルをサポートしていません。外部テーブルで WITH PARTITION COLUMNS 句が見つかった場合、この EWI を使用してサポートされていないとしてマークされます。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Remove the WITH PARTITION COLUMNS clause: Snowflake external tables use automatic partitioning based on the file path. Remove the
WITH PARTITION COLUMNSclause from the generated code.Use Snowflake partitioning: Define partition columns using expressions in the external table's column definitions. Snowflake can automatically infer partition columns from the directory structure.
Hive metastore integration: If you use a Hive metastore, consider integrating it with Snowflake to synchronize external table metadata automatically.
SSC-EWI-BQ0015¶
External table requires an external stage to access an external location, define and replace the EXTERNAL_STAGE placeholder
警告
この EWI は非推奨です。この EWI の最新バージョンについては、[SSC-EWI-0032( generalEWI.md#ssc-ewi-0032)ご参照ください。
説明¶
CREATE EXTERNAL TABLE ステートメントを変換すると、 SnowConvert AI は EXTERNAL _STAGE プレースホルダーを生成します。これは、Snowflakeから外部の場所に接続するために作成された外部ステージに置き換える必要があります。
以下のガイドを参照して、Snowflakeアカウントで必要なストレージ統合と外部ステージを設定してください。
[Amazon S3を参照する外部テーブルの場合](https://docs.snowflake.com/ja/user-guide/tables-external-s3)
[Google Cloud Storageを参照する外部テーブルの場合](https://docs.snowflake.com/ja/user-guide/tables-external-gcs)
[Azure Blob Storageを参照する外部テーブルの場合](https://docs.snowflake.com/ja/user-guide/tables-external-azure)
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
CREATE OR REPLACE EXTERNAL TABLE test.Employees_test
(
Employee_id INTEGER AS CAST(GET_IGNORE_CASE($1, 'c1') AS INTEGER),
Name STRING AS CAST(GET_IGNORE_CASE($1, 'c2') AS STRING),
Mail STRING AS CAST(GET_IGNORE_CASE($1, 'c3') AS STRING),
Position STRING AS CAST(GET_IGNORE_CASE($1, 'c4') AS STRING),
Salary INTEGER AS CAST(GET_IGNORE_CASE($1, 'c5') AS INTEGER)
)
!!!RESOLVE EWI!!! /*** SSC-EWI-BQ0015 - EXTERNAL TABLE REQUIRES AN EXTERNAL STAGE TO ACCESS gs://sc_external_table_bucket, DEFINE AND REPLACE THE EXTERNAL_STAGE PLACEHOLDER ***/!!!
LOCATION = @EXTERNAL_STAGE
AUTO_REFRESH = false
PATTERN = 'folder_with_csv/Employees.csv'
FILE_FORMAT = (TYPE = CSV SKIP_HEADER =1);
推奨事項¶
Snowflakeアカウントで外部接続を設定し、 EXTERNAL_STAGE プレースホルダーを置き換えて変換を完了します。
さらにサポートが必要な場合は、[snowconvert-support@snowflake.com](mailto:snowconvert-support@snowflake.com)までメールでお問い合わせください。
SSC-EWI-BQ0016¶
複数の UNNEST 演算子を使用したSelect * は、列のあいまいさを引き起こします。
警告
This EWI is deprecated; please refer to SSC-FDM-0012 for the latest version of this issue.
重大性¶
中
説明¶
UNNEST 演算子の SnowConvert 変換の一部として、[FLATTEN](../../../../../../sql-reference/functions/flatten.rst)関数が使用されます。この関数は、 THIS 列や PATH 列など、UNNEST 演算子の機能をエミュレートするために必要のない複数の列を生成します。
UNNEST 演算子を伴う SELECT * が見つかった場合、 SnowConvert は EXCLUDE キーワードを使用して不要な列を削除します。ただし、同じステートメントで複数の UNNEST 演算子が使用されている場合、あいまいさの問題により列を削除できません。このようなケースを示すために、この EWI が生成されます。
この問題を解決するために、 SELECT 式リストを拡張して、期待される列のみを指定することをお勧めします。
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
SSC-EWI-BQ0017¶
Pending SnowConvert AI translation for UNNEST of an array of structs
重大性¶
中
説明¶
When unnesting an array of structs, BigQuery generates a column for each struct field and splits the struct values into their corresponding columns. SnowConvert AI does not yet support this transformation. Whenever SnowConvert AI detects that the UNNEST operator is applied over an array of structs, this EWI is generated to flag the need for manual conversion.
コード例¶
入力コード:¶
BigQuery¶
生成されたコード:¶
Snowflake¶
推奨事項¶
Use FLATTEN with LATERAL: Manually flatten the array column using Snowflake's FLATTEN function, then extract individual struct fields using dot notation or
GETon theVALUEcolumn.Example workaround: