如何使用特定交易 ID 编写代码进行时间旅行
How to write a code to timetravel using a specific transaction ID
我想在 snowflake 上使用时间旅行功能并恢复原始 table。
我使用以下命令删除并创建了 table:
DROP TABLE "SOCIAL_LIVE"
CREATE TABLE "SOCIAL_LIVE" (...)
我想在删除 table 之前回到原来的 table。
我使用了以下代码(将交易 ID 隐藏到 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
Select "BW"."PUBLIC"."SOCIAL_LIVE".* From "BW"."PUBLIC"."SOCIAL_LIVE";
select * from SOCIAL_LIVE before(statement => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
收到一条错误消息:
Statement xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx cannot be used to specify time for time travel query.
我们如何才能回到原来的table并在雪花上恢复它?
文档指出:
After dropping a table, creating a table with the same name creates a
new version of the table. The dropped version of the previous table
can still be restored using the following method:
Rename the current version of the table to a different name.
Use the UNDROP TABLE command to restore the previous version.
如果您需要更多信息,此页面很有用:
https://docs.snowflake.net/manuals/sql-reference/sql/drop-table.html#usage-notes
不过,您需要取消删除 table 才能访问该数据。时间旅行并不仅仅靠名字来维护。所以,一旦你放下并重新创建了 table,新的 table 就有了自己的新时间旅行。
语句xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx不能用于时间旅行查询指定时间。
通常当我们试图落后于对象创建时间时,我们会遇到上述错误。尝试使用带有偏移选项的时间旅行选项。
似乎有 3 个常见的错误原因,以及解决方案:
- table 已删除并重新创建
- 见
- 时间旅行期已过
- 无解:针对table
的时间旅行周期内的语句
- 定位到错误的语句类型
- 只能定位某些语句类型。目前,这些包括
SELECT
、BEGIN
、COMMIT
和 DML(INSERT
、UPDATE
等)。 See documentation here.
我想在 snowflake 上使用时间旅行功能并恢复原始 table。
我使用以下命令删除并创建了 table:
DROP TABLE "SOCIAL_LIVE"
CREATE TABLE "SOCIAL_LIVE" (...)
我想在删除 table 之前回到原来的 table。
我使用了以下代码(将交易 ID 隐藏到 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
Select "BW"."PUBLIC"."SOCIAL_LIVE".* From "BW"."PUBLIC"."SOCIAL_LIVE";
select * from SOCIAL_LIVE before(statement => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
收到一条错误消息:
Statement xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx cannot be used to specify time for time travel query.
我们如何才能回到原来的table并在雪花上恢复它?
文档指出:
After dropping a table, creating a table with the same name creates a new version of the table. The dropped version of the previous table can still be restored using the following method:
Rename the current version of the table to a different name.
Use the UNDROP TABLE command to restore the previous version.
如果您需要更多信息,此页面很有用:
https://docs.snowflake.net/manuals/sql-reference/sql/drop-table.html#usage-notes
不过,您需要取消删除 table 才能访问该数据。时间旅行并不仅仅靠名字来维护。所以,一旦你放下并重新创建了 table,新的 table 就有了自己的新时间旅行。
语句xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx不能用于时间旅行查询指定时间。
通常当我们试图落后于对象创建时间时,我们会遇到上述错误。尝试使用带有偏移选项的时间旅行选项。
似乎有 3 个常见的错误原因,以及解决方案:
- table 已删除并重新创建
- 见
- 见
- 时间旅行期已过
- 无解:针对table 的时间旅行周期内的语句
- 定位到错误的语句类型
- 只能定位某些语句类型。目前,这些包括
SELECT
、BEGIN
、COMMIT
和 DML(INSERT
、UPDATE
等)。 See documentation here.
- 只能定位某些语句类型。目前,这些包括