LOAD SNAPSHOT
Overview
Loads one or more previously saved snapshots into the current pipeline dataset, given an exact name
or a name pattern (for example sales*).
SINCE— limits the load to snapshots created or modified on or after the date/time or epoch value provided.ENCRYPT_CERT— decrypts snapshots that were saved with SAVE SNAPSHOT encryption, using the matching X.509 certificate thumbprint.
After a load, the snapshot data becomes the current pipeline dataset (also available as
@pipelinedata() inside EXEC ON DB). You can still reference other named
snapshots on the fly with @snapshot(name). See
Snapshots in the Development Guide.
Syntax
Loads one or more snapshots as the current data pipeline given its name or a name pattern.
LOAD SNAPSHOT '...'
{ SINCE '...' }
{ ENCRYPT_CERT '...' }
;SINCE |
A date/time or epoch value from which to load available snapshots |
ENCRYPT_CERT |
The thumbprint of an X.509 certificate used to decrypt the snapshot |
Example 1
-- Load a previously saved snapshot given its name
LOAD SNAPSHOT 'customers';
-- Save the data into a database table
SINK INTO DB [sql2017]
TABLE 'tmpcustomers'
WITH RECREATE;
Example 2
-- Load a available snapshots that start with 'sales'
-- that were created over the last 30 days and encrypted
-- using an X.509 certificate
LOAD SNAPSHOT 'sales*'
SINCE '#dateadd(#utcnow(), -30d)'
ENCRYPT_CERT 'AF3F70E678504176F0E05578C07749FB6936936C';
-- Use the snapshots retrieved in a SQL operation, which is now represented
-- as @pipelinedata(), and also load another snapshot on the fly within
-- the deep ETL operation using @snapshot(name)
EXEC ON DB [sql2017]
(
SELECT * FROM
@pipelinedata() allsales -- the current pipeline data
WHERE [state] = 'FL'
AND allsales.custId IN (
SELECT id FROM @snapshot(customers) as cust -- an existing snapshot
WHERE isActive = 1
)
;
) WITH REPLACE;
