question

Thanuja avatar image
Thanuja asked Erick Ramirez answered

How do we perform DML operations and functions in a single job?

HI,

I need to perform the below steps to delete the records from multiple tables of the completed one's once they ages out to 18 months after the order changed to completed.

1) Count the number of orders when the status is completed

2) check the condition - count>0

Fetch all the orders which are completed

loop to each orderID

calc TTL based on the completion date(18 months - duration(Todays date - completion date) )

update the TTL to the records of that order

Once TTL updated to the records of completed orders, then they will automatically deleted from DataStax.

Is there a way to perform both DML statements and do some calculations at one place and call that JOB periodically.

user-defined function
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

You have an analytics use case so my recommendation is to write an ETL job in Spark which will do this for you. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.