Date Table Generation Notebook for Databricks Unity Catalog

How to create an epic date table in Databricks

SQLDATABRICKSAUTOMATIONDATE TABLE

8/10/20231 min read

No lengthy life story of what bubble tea I was drinking when creating this or childhood memories like some food bloggers. The code is below - look at the comments if you have questions.

Features of the date table:

  • Gregorian fields

  • Fiscal Period Fields (this is configurable to start at any month of the year. There is now day level shift to have the fiscal period start at e.g. the 25th. Only a month level shift.

  • Boolean fields – these are to be used in reporting platforms for easy filtering of special date ranges such as current and last month, previous 12 months, current day etc.

  • Retail calendar – many times companies want to bucket weeks into perfectly comparable fields so that day of week to previous weeks can be compared more accurately.

  • Public holidays and special days

Hit up my GitHub to get your paws on the notebook with the code.

Live long and prosper.

In this episode of “How do I create a date table form nothing in my chosen platform”? I am covering Databricks.

Pics or it didn't happen...

Thank you for reading my ramblings, if you want to you can buy me a coffee here: 

Support Dian Germishuizen on Ko-fi! ❤️