cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow file watch - capture filename trigger

csmcpherson
New Contributor III
With respect to the file watch trigger in workflows, how can we capture what files and or path was identified as raising the trigger? 
 
I'd like to use this information to set parameters based upon the file name and the file path 
 
Thank you! 
 
1 ACCEPTED SOLUTION

Accepted Solutions

szymon_dybczak
Contributor III

Hi @csmcpherson ,

This is currently not supported, but databricks team is working on that idea according to below thread:

Solved: File information is not passed to trigger job on f... - Databricks Community - 39266

As a workaround, if you use autoloader, you can use file _metadata column.

File metadata column - Azure Databricks | Microsoft Learn

spark.readStream \
  .format("cloudFiles") \
  .option("cloudFiles.format", "csv") \
  .schema(schema) \
  .load("abfss://my-bucket/csvData") \
  .selectExpr("*", "_metadata as source_metadata") \
  .writeStream \
  .format("delta") \
  .option("checkpointLocation", checkpointLocation) \
  .start(targetTable)

 

View solution in original post

1 REPLY 1

szymon_dybczak
Contributor III

Hi @csmcpherson ,

This is currently not supported, but databricks team is working on that idea according to below thread:

Solved: File information is not passed to trigger job on f... - Databricks Community - 39266

As a workaround, if you use autoloader, you can use file _metadata column.

File metadata column - Azure Databricks | Microsoft Learn

spark.readStream \
  .format("cloudFiles") \
  .option("cloudFiles.format", "csv") \
  .schema(schema) \
  .load("abfss://my-bucket/csvData") \
  .selectExpr("*", "_metadata as source_metadata") \
  .writeStream \
  .format("delta") \
  .option("checkpointLocation", checkpointLocation) \
  .start(targetTable)

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group