Microsoft Azure - EventGridSchema BlobCreated event fires before blob is commited

Viewed 40

We are in the process of implementing auto ingestion of data between a snowflake data warehouse and an azure data container (enter link description here)

Based on the snowflake documentation we created an Azure storage account, a container where the blobs will be downloaded nightly, a queue and added the event subscription whose end point is the storage queue that filters on the blob created event. Below is a screen shot of the Azure event subscription.

enter image description here

We use a logic app to connect to the client FTP site to download the files to the storage container. A simple FTP job - Trigger when a new file is added, Get File content using path and Create blob. Screen shot below

enter image description here

However what we have been seeing is that for certain files the data ingestion starts before the blob is committed to the storage container. This results in a failure to load data. After working with support at snowflake and trouble shooting at our end it does seem like the blob created event is fired before the blob is committed.

Is there any way for me to resolve this. Or any pointers as to how to investigate this further.

Regards Sid

1 Answers

We found the reason why the blob is not consumed. We created a test logic application that is triggered when a resource event occurs and configured it for the Micrsoft.Storage.BlobCreated event

enter image description here

What we found was - when the logic application executed the Create Blob step it send 3 BlobCreated events for the same file. The difference between the 3 messages is in the api field and the contentLength field of the event. For the 1st message the api field value is "PutBlob" and then "PutBlockList" for the subsequent messages.

Since Snowflake snowpipes have a deduping feature where the same blobs will not be consumed, any subsequent messages after the first are ignored.

As a fallback we migrated this process to Azure data factory where we download the files and only 1 BlobCreated event is triggered.

Related