I have a type 2 dimension in Azure SQL Data Warehouse.
Essentially I am creating an interim table with
CREATE TABLE myDimension_temp
AS
SELECT
...
FROM myStagingTable;
etc
After the CTAS is complete I do a
RENAME OBJECT myDimension TO myDimension_old;
RENAME OBJECT myDimension_tmp TO myDimension;
DROP TABLE myDimension_old;
Is there a way to lock these tables so that any actions against myDimension are blocked until the renaming of both tables is complete?
If so, is this worth implementing or is the time it takes to swap out tables in this manner so negligible that the chances of this occurring are too small to worry about or am I looking at/going about this in completely the wrong way?