This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I am truly struggling doing something I thought it would be rather simple in Alteryx, most likely because I am fairly new to the tool.
I have a simple table in my db called trigger that I need to backup (append) to another table called trigger_backup, then delete all its records and then populate it with new data from a local file I have. All of this needs to happen in the same workflow.
Things I am struggling with:
-I don't know how to make Alteryx run the backup first, delete all records second, and write new info third. I need things to happen in this order.
This is a process I actually do all the time. Another approach would be as follows:
use Input Data to read in from your Trigger table
use Output Data to write into your Trigger backup table using "Append Existing" as the output option
You didn't mention anything about unique values. If you have a unique constraint on the backup table, depending on your DB type, you will need to have a PRIMARY KEY defined (not just a unique index) and then use "Update - insert if new" as the output option
You can use the block until done setup that fevizcaino provided to tie the parts together
New data insert
use Input Data to read in your csv
use Output Data to write into your Trigger table
Output Options you can use "Delete Data and Append" if you want to keep your column definitions in place and indexes
OR you can use "Overwrite table (drop)" but that will recreate the table based on the datatypes / lengths that Alteryx finds in the new CSV file and you would have to put in Post Create SQL Statement any index create statements
If I missed anything, let me know, but this should be very straight forward using just this handful of tools.