Use offset of Windowstart in azure data factory - azure

I wish to incrementally copy data from azure table to azure blob. I have created linked services, datasets and pipelines. I wish to copy data from table to blob after every hour. The table has a timestamp column.I want to transfer data from table to blob in such a way that the data which gets added to the table from 7am to 8am should be pushed to blob in activity window starting at 8 am. In other words, I don't want to miss any data flowing into the table.

I have changed the query used to extract data from the azure table.
"azureTableSourceQuery": "$$Text.Format('PartitionKey gt \\'{0:yyyyMMddHH} \\' and PartitionKey le \\'{1:yyyyMMddHH}\\'', Time.AddHours(WindowStart, -2), Time.AddHours(WindowEnd, -2))"
This query will get data which was added to the table 2 hours back and hence I wont miss any data.

Related

Need to do an incremental load using ADF. Source is a csv from ADLS and Sink is Azure SQL

I am trying to do an incremental data load to Azure sql from csv files in ADLS through ADF. The problem I am facing is Azure SQL would generate the primary key column (ID) and the data would be inserted to Azure SQl. But when the pipeline is re triggered the data would be duplicated again. So how do I handle these duplicates ? Because only incremental load should be updated everytime but since primary key column is generated by SQL there would be duplicates every run. Please help !!
You can consider comparing source and sink data first by excluding
Primary key column and then filter that rows which modified and take
it to sink table.
In below video I created a hash on top of few columns from source and sink and compared them to identify changed data. Same way you can consider checking the changed data first and then load it to sink table.
https://www.youtube.com/watch?v=i2PkwNqxj1E

Azure Data Factory DataFlow Filter is taking a lot of time

I have an ADF Pipleline which executes a DataFlow.
The Dataflow has Source A table which has around 1 Million Rows,
Filter which has a query to select only yesterday's records from the source table,
Alter Row settings which uses upsert,
Sink which is archival table where the records are getting upsert
This whole pipeline is taking around 2 hours or so which is not acceptable. Actually, the records being transferred / upserted are around 3000 only.
Core count is 16. Tried the partitioning with round robin and 20 partitions.
Similar archival doesn't take more than 15 minutes for another table which has around 100K records.
I thought of creating source which would select only yesterday's record but the dataset we can select only table.
Please suggest if I am missing anything to optimize it.
The table of the Data Set really doesn't matter. Whichever activity you use to access that Data Set can be toggled to use a query instead of the whole table, so that you can pass in a value to select only yesterday's data from the database.
Or course, if you have the ability to create a stored procedure on the source, you could also do that.
When migrating really large sets of data, you'll get much better performance using a Copy activity to stage the data into an Azure Storage Blob before using another Copy activity to pull from that Blob into the source. But, for what you're describing here, that doesn't seem necessary.

Not Loading all columns from Azure Table Storage Source in Azure Data Factory

I am trying to copy data from Azure Table Storage to Csv file using "Copy Activity" in Azure Data Factory. But few columns are not loading.
In Azure Table Source Dataset Preview I'm not able to see all columns. Those columns have Null data for first 400 rows. If i have data for all fields in first 11 rows then i am able to see and load all fields data.
But in my case for few fields we have null data for few rows so how to load all columns data?
Couple of points
In preview we always show a few of records and not all .
The table storage is not a schema based storage and the null are treated differently here . I think this \
Querying azure table storage for null values
will help you understand more .
I am pretty confident that when you run the copy activity it will copy all the records to the sink , even if you do see few in the preview .
I meet the same problem "Not Loading all columns from Azure Table Storage Source in Azure Data Factory". I think it may be a bug of Azure Data Factory.

Extract subset of SalesForce table filtered by a daily dynamic date with azure data factory

I need to extract daily data from a SalesForce table, then output it as a JSON file in order to send it to an other server everyday.
I wonder if it's possible to do this with Azure Data Factory. Currently, I've seen a static way of doing it with this type a request :
$$Text.Format('SELECT * FROM Account WHERE LastModifiedDate >= {{ts\'{0:yyyy-MM-dd HH:mm:ss}\'}} AND LastModifiedDate < {{ts\'{1:yyyy-MM-dd HH:mm:ss}\'}}', WindowStart, WindowEnd)
I can't find a way to have WindowStart and WindowEnd to be dynamic (because I want all rows concerning only the previous day).

How can I copy dynamic data from on prem sqlserver to azure datawarehouse

I have created a linked service that takes the data from on prem and store into the azure blob, but my data is dynamic how can I build a pipeline that takes the updated table into the blob and takes that blob and transfer it into the azure datawarehouse, I need this in such a way so that all my tables are in realtime sync into the azure datawarehouse.
What you are probably looking for is incrementally loading data into your datawarehouse.
The procedure described below is documented here. It assumes you have periodic snapshots of your whole source table into blobstorage.
You need to elect a column to track changes in your table.
If you are only appending and never changing existing rows, the primary key will do the job.
However, if you have to cope with changes in existing rows, you need a way to track those changes (for instance in with a column named "timestamp-of-last-update" - or any better, more succinct name).
Note: if you don't have such a column, you will not be able to track changes and therefore will not be able to load data incrementally.
For a given snapshot, we are interested in the rows added or updated in the source table. This content is called the delta associated to the snapshot. Once delta is computed, it can be upserted into your table with a Copy Activity that invokes an stored procedure. Here you can find details on how this is done.
Assuming the values of the elected column will only grow as rows are added/updated in the source table, it is necessary to keep track of its maximum value through the snapshots. This tracked value is called watermark. This page describes a way to persist the watermark into SQL Server.
Finally, you need to be able to compute the delta for a given snapshot given the last watermark stored. The basic idea is to select the rows where the elected column is greater than the stored watermark. You can do so using SQL Server (as described in the referred documentation), or you can use Hive on HDInsight to do this filtering.
Do not forget to update the watermark with the maximum value of the elected column once delta is upserted into your datawarehouse.

Resources