【发布时间】:2020-10-26 00:07:29
【问题描述】:
我正在从外部位置使用copy-into-table,并且可以选择continue loading 数据,以防该行的数据损坏。是否有一个选项可以显示加载时跳过了多少行,就像 Teradata TPT 中有一个选项一样。
【问题讨论】:
标签: snowflake-cloud-data-platform snowflake-schema
我正在从外部位置使用copy-into-table,并且可以选择continue loading 数据,以防该行的数据损坏。是否有一个选项可以显示加载时跳过了多少行,就像 Teradata TPT 中有一个选项一样。
【问题讨论】:
标签: snowflake-cloud-data-platform snowflake-schema
假设您没有在 COPY INTO 命令中进行转换,您可以在加载后利用 VALIDATE() 函数并获取跳过的记录以及未加载它们的原因:
https://docs.snowflake.com/en/sql-reference/functions/validate.html
示例其中 t1 是您正在加载的表。如果你知道,你也可以指定一个特定的 query_id:
select * from table(validate(t1, job_id => '_last'));
【讨论】:
COPY INTO outputs the following columns:
ROWS_PARSED: Number of rows parsed from the source file
ROWS_LOADED: Number of rows loaded from the source file
ERROR_LIMIT: If the number of errors reaches this limit, then abort
ERRORS_SEEN: Number of error rows in the source file
跳过的行数可以计算为ROWS_PARSED - ROWS_LOADED。我正在使用pyodbc,这些列的解析可能与您编写脚本的方式不同。
【讨论】: