Skip to content

Instantly share code, notes, and snippets.

@robert8138
Last active February 6, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robert8138/9ebe45a8b726702b4c6ac43df8f736f0 to your computer and use it in GitHub Desktop.
Save robert8138/9ebe45a8b726702b4c6ac43df8f736f0 to your computer and use it in GitHub Desktop.
An example of dynamic partitions
INSERT OVERWRITE TABLE bookings_summary PARTITION (ds)
SELECT
dim_market
, SUM(m_bookings) AS m_bookings
, ds # For Hive to know we are using dynamic partitions
FROM
fct_bookings
WHERE
ds BETWEEN '{{ earliest_ds }}' AND '{{ latest_ds }}'
GROUP BY
dim_market
, ds
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment