Adding Current Date to DB Sink Mapping

73 Views Asked by At

I am currently using our Data Factory to fetch an .xlsx file from an open API, and then write the data to a table in our database. For this task, I use two copy activities. One of them copies the file to our data lake storage, the other fetches the file and writes it to an existing table in our database.

I am now looking for a way to fetch the current date in ADF, maybe as a variable, and add this information to the sink mapping, so that the table receives additional columns, which for today would contain '2024-02-12'.

I tinkered with variables a bit, as well as the set variable activity to no avail. Most solutions I have found are a little too complicated for my use case, since I only strictly need the current date, without any additional conditions. Any idea how to get this?

1

There are 1 best solutions below

2
On BEST ANSWER

To get the current date as a new column on the sink side, create a new additional column with the dynamic expression @utcnow('yyyy-MM-dd') to obtain the current date in copy activity itself, as shown below:

enter image description here

Afterward, you will see the new column as below on the sink side:

enter image description here