cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Current date as one of the column in Databricks

Neli
New Contributor II

imageimageI am trying to create new column "Ingest_date" in table which should contain current date. I am getting error "Current date cannot be used in a generated column". Can you please review and suggest alternative to get the current date in delta table.

2 REPLIES 2

daniel_sahal
Esteemed Contributor

A generation expression can use any SQL functions in Spark that always return the same result when given the same argument values

Source: https://docs.delta.io/latest/delta-batch.html#use-generated-columns

It means that it's intended to not work.

You can still insert the value of current_date() in your ingestion pipeline.

Neli
New Contributor II

Thank you Daniel. Appreciate your inputs.

This is the requirement which i am trying to achieve. I will create a table with 5 columns and 4 columns will be inserted by process . Ingest date column should be populated with current date when columns are inserted.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!