- 1 Minute to read
- Print
- DarkLight
- PDF
Upsert-Merge for Firebolt
- 1 Minute to read
- Print
- DarkLight
- PDF
Using Rivery, Firebolt users can perform an Upsert-Merge data flow - using views and flip-flop method.
Firebolt views design
The table names you define in your rivers will be represented as a views in your Firebolt database.
This design was chosen to ensure maximum data availability at all times.
The way it is done is by alternating between two tables after every successful river run, the name of the tables are the table name + "_flip" or "_flop".
e.g. table name is "facebook_insights" underlying tables would be "facebook_insights_flip" and "facebook_insights_flop".
You can find the name of the current underlying table from the views schema by exploring the DDL of the view.
If you wish to make changes such as adding additional AGGREGATION or JOIN indexes to your tables you can do it by querying the views information_schema and extract the DDL and then adding the new index to that table and also to the other table.
Do note that every other change such as partitions or primary index should be done only VIA the Rivery console.
Flip/Flop flow
Below you can find additional details on the Flip/Flop flow
- New data arrives
- If there is no current target view
- Create flip table with the new data
- Create a view over the flip table
- If there is only flip table
- Create flop table
- Drop the current view
- Create a new view over the flop table
- If both flip/flop tables exists
- Check what is the current table the view is based upon
- If flip
- Drop flop
- Recreate flop with new data
- Drop current view
- Create view over flop
- If flop
- Drop flip
- Recreate flip with new data
- Drop current view
- Create view over flip