danielvdende
danielvdende

Reputation: 710

Azure Data Factory Python SDK Create Trigger

I'm working with the Azure Data Factory Python SDK to create a Trigger as documented here. Unfortunately, it's not working and I'm getting a very cryptic error message.

I'm using the following code (as per the example):

tr_name = 'mytrigger'
scheduler_recurrence = ScheduleTriggerRecurrence(frequency='Minute', interval='15',start_time='2017-12-12T04:00:00Z', end_time='2017-12-12T05:00:00Z', time_zone='UTC')
pipeline_parameters = {'inputPath':'adftutorial/input', 'outputPath':'adftutorial/output'}
pipelines_to_run = []
pipeline_reference = PipelineReference(reference_name='copyPipeline')
pipelines_to_run.append(TriggerPipelineReference(pipeline_reference=pipeline_reference, parameters=pipeline_parameters))
tr_properties = ScheduleTrigger(description='My scheduler trigger', pipelines = pipelines_to_run, recurrence=scheduler_recurrence)


adf_client.triggers.create_or_update(rg_name, df_name, tr_name, tr_properties)

The error I'm getting is:

azure.core.exceptions.HttpResponseError: (InvalidPropertyValue) Invalid value for property 'Properties'
Code: InvalidPropertyValue
Message: Invalid value for property 'Properties'
Target: mytrigger

which doesn't tell me much at all :-(. Has anyone seen this before? I'm struggling to figure this out. I've looked for an attribute Properties, but there doesn't seem to be one. Is there a good way to debug what's going on here?

Upvotes: 1

Views: 606

Answers (1)

Ecstasy
Ecstasy

Reputation: 1864

To resolve this azure.core.exceptions.HttpResponseError: (InvalidPropertyValue) Invalid value for property 'Properties' error:

Instead of:

tr_properties = ScheduleTrigger(description='My scheduler trigger', pipelines = pipelines_to_run, recurrence=scheduler_recurrence)

You can try this:

tr_properties = TriggerResource(properties=ScheduleTrigger(description='My scheduler trigger',pipelines=pipelines_to_run,recurrence=scheduler_recurrence))

You can refer to Bad body serialization creating a Schedule Trigger in Data Factory and Azure data factory trigger creation using python SDK

Upvotes: 1

Related Questions