Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

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 characters needed characters left characters exceeded

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 characters needed characters left characters exceeded

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