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 III

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 III

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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group