Utility functions for dbt projects. Contribute to hui-jie-lim/dbt-utils development by creating an account on GitHub.
date_spine (source) This macro returns the sql required to build a date spine. The spine will include the start_date (if it is aligned to the datepart), but it will not include the end_date. Usage: {{ dbt_utils.date_spine( datepart="day", start_date="cast('2019-01-01' as date...
date_spine: Creates a continuous sequence of dates between two specified dates, useful for time series analysis. pivot: Transform rows into columns dynamically, simplifying crosstab operations. star: Gets all fields from specified tables in the model, excluding those in the except argument. union_re...
This macro returns the sql required to build a date spine. The spine will include the start_date (if it is aligned to the datepart), but it will not include the end_date. Usage: {{ dbt_utils.date_spine( datepart="day", start_date="cast('2019-01-01' as date)", end_date="cast...
dbt_codegenUse the package to help you generate YML files for your models and sources and SQL files for your staging models. dbt_utilsThe package contains macros useful for daily development. For example,date_spinegenerates a table with all dates between the ones provided as parameters. ...
maintainer, I only need to reimplement the foundational building-block macros which encapsulate low-level syntactical differences. By reimplementing low-level macros, such asspark__dateaddandspark__datediff, thespark_utilspackage provides access to more complex macros (dbt_utils.date_spine) "for free...
This macro returns the sql required to build a date spine. The spine will include the start_date (if it is aligned to the datepart), but it will not include the end_date. Usage: {{ dbt_utils.date_spine( datepart="day", start_date="cast('2019-01-01' as date)", end_date="cast...
This macro returns the sql required to build a date spine. The spine will include the start_date (if it is aligned to the datepart), but it will not include the end_date. Usage: {{ dbt_utils.date_spine( datepart="day", start_date="cast('2019-01-01' as date)", end_date="cast...
We realized that since we were already maintaining an hourly-grain date dimension table using thedatespine macro from dbt_utils, as mentioned above, we could adjust the booleanis_business_hourto reflect the changing schedules over time. Then, we can use the hourly grain table to control the ...
Cross-database macrosdate_spine✅no customization examples for cross DB macros replace {{ dbt.replace("string_text_column", "old_chars", "new_chars") }} {{ replace('abcgef', 'g', 'd') }} date_trunc {{ dbt.date_trunc("date_part", "date") }} {{ dbt.date_trunc(...