Last active
February 6, 2018 16:56
-
-
Save robert8138/73451dd1913f99d0ae454c322402210a to your computer and use it in GitHub Desktop.
Dynamic Partitions Start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT OVERWRITE TABLE bookings_summary PARTITION (ds= '{{ earliest_ds }}') | |
SELECT | |
dim_market | |
, SUM(m_bookings) AS m_bookings | |
FROM | |
fct_bookings | |
WHERE | |
ds = '{{ earliest_ds }}' | |
GROUP BY | |
dim_market | |
; | |
# after many insertions from '{{ earliest_ds + 1 day }}' to '{{ latest_ds - 1 day }}' | |
INSERT OVERWRITE TABLE bookings_summary PARTITION (ds= '{{ latest_ds }}') | |
SELECT | |
dim_market | |
, SUM(m_bookings) AS m_bookings | |
FROM | |
fct_bookings | |
WHERE | |
ds = '{{ latest_ds }}' | |
GROUP BY | |
dim_market | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment