cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.