Data Protection and Sharing

Snowflake Architecture

Emily Melhuish

Technical Curriculum Developer, Snowflake

When Something Goes Wrong

Before

  • subscription table has 847 rows
DELETE FROM subscriptions
WHERE status = 'inactive';

woopsie.png

After

  • subscription table has 0 rows
  • Snowflake preserves state of your data before every change
  • Window of time configuration

timetravel.png

Snowflake Architecture

Time Travel

  • Query data at any point in time in the retention window
  • DATA_RETENTION_TIME_IN_DAYS can be set at account, database, schema, or table (lowest level wins)
  • Standard: a one-day window is maximum data retention time
  • Enterprise: up to 90 days (per edition and object rules)
  • Not limited to SELECT queries

Timeline showing now and 90 days ago

Snowflake Architecture

Navigating History: Timestamp and Offset

  • AT TIMESTAMP
    • Exact moment in time
  • AT OFFSET
    • Number in seconds
    • Negative means backwards
    • -3600 = one hour ago
Snowflake Architecture

Navigating History: Statement and Undrop

  • AT BEFORE(STATEMENT) / BEFORE(STATEMENT)

    • Ties recovery using its query id
    • You return to the state of the data before that statement
  • UNDROP

    • For example, UNDROP TABLE t
    • Only works while it is still recoverable
Snowflake Architecture

Fail-Safe

  • Automatically retains the data a further 7 days after time travel (Fail-safe)
  • Default, no enablement needed
  • Snowflake support required to recover
  • data in Fail-safe counts against your bill

Timeline showing options

Snowflake Architecture

Zero-Copy Cloning

SQL

CREATE TABLE SUBSCRIPTIONS_BACKUP 
  CLONE subscriptions;

Output

Table SUBSCRIPTIONS_BACKUP 
successfully created.
  • Clone shares underlying storage
  • Storage is only charged when the table starts to diverge

Show clone and zero sharing storage

Snowflake Architecture

Snowflake Marketplace

Snowflake marketplace screenshot

Snowflake Architecture

Let's practice!

Snowflake Architecture

Preparing Video For Download...