![]() Using the DATEDIFF macro, you can calculate the difference between two dates without having to worry about finicky syntax. Now, cross-database macros are available regardless if dbt utils is installed or not. Previously, dbt_utils, a package of macros and tests that data folks can use to help write more DRY code in their dbt project, powered cross-database macros. ![]() With dbt v1.2, adapters now support cross-database macros to help you write certain functions, like DATE_TRUNC and DATEDIFF, without having to memorize sticky function syntax. Luckily, dbt-core has your back! dbt Core is the open source dbt product that helps data folks write their data transformations following software engineering best practices. What happens when you switch to a different one for a new job or a new data stack? Remembering if there’s an underscore in the function name or which argument the is passed in as is… no fun and leads to the inevitable, countless “datediff in bigquery” Google searches. You may be able to memorize the syntax for the DATEDIFF function for the primary data warehouse you use. BigQuery also supports a separate DATE_DIFF function that will return the difference between two date types, unlike the DATETIME_DIFF that only supports the datetime type.Ī hero in the shadows: The DATEDIFF dbt macro! #
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |