Skip to content

Instantly share code, notes, and snippets.

@jingningzhang1
Created June 23, 2022 23:54
Show Gist options
  • Save jingningzhang1/9a0b199cd41c839ff375079024ebafb6 to your computer and use it in GitHub Desktop.
Save jingningzhang1/9a0b199cd41c839ff375079024ebafb6 to your computer and use it in GitHub Desktop.
-- DBTITLE 1,Incrementally Ingest Source Data from Raw Files
COPY INTO plotly_iot_dashboard.bronze_sensors
FROM (SELECT
id::bigint AS Id,
device_id::integer AS device_id,
user_id::integer AS user_id,
calories_burnt::decimal(10,2) AS calories_burnt,
miles_walked::decimal(10,2) AS miles_walked,
num_steps::decimal(10,2) AS num_steps,
timestamp::timestamp AS timestamp,
value AS value
FROM "/databricks-datasets/iot-stream/data-device/")
FILEFORMAT = json
COPY_OPTIONS('force'='true') --option to be incremental or always load all files
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment