Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.52k stars 2.75k forks source link

error using create_or_update(...) #16478

Closed schmocker closed 3 years ago

schmocker commented 3 years ago

If I try to create_or_update an BlobEventsTrigger using Python I get the following request. azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'

I'm currently changed to the following versions:

azure-mgmt-datafactory==1.0.0
azure-mgmt-resource==15.0.0
azure-mgmt-storage==16.0.0
azure-mgmt-sql==1.0.0
azure-storage-blob==12.7.1
azure-identity==1.5.0

My Code for the BlobEventsTrigger

I tried using .validate() on the BlobEventsTrigger and the TriggerResource and both are fine.

I could create LinkedServices, Datasets and Pipelines but no Triggers - I have the same issue with TumblingWindowTrigger.

Am I missing something or are the Triggers in the current version not stable?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

schmocker commented 3 years ago

I just figured it out. My code is fine. I had to remove the triggers before I could create them again with the new version. I wasn't able to perform create_or_update() while having triggers created by the old version or it is because they haven't stopped. One way or the other - it would be nice to have a corresponding feedback in the error and not only: azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @shawnxzq, @lmy269.

Issue Details
If I try to create_or_update an BlobEventsTrigger using Python I get the following request. **azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'** I'm currently changed to the following versions: ``` azure-mgmt-datafactory==1.0.0 azure-mgmt-resource==15.0.0 azure-mgmt-storage==16.0.0 azure-mgmt-sql==1.0.0 azure-storage-blob==12.7.1 azure-identity==1.5.0 ``` My Code for the BlobEventsTrigger * I could create_or_update the `pipeline` ```python parameters = { 'dl_container': 'raw', 'dl_folder_path': '@triggerBody().folderPath', 'dl_file_name': '@triggerBody().fileName', 'db_schema': 'sa', 'db_table': "sa_@{last(split(triggerBody().folderPath,'/'))}_@{split(triggerBody().fileName,'.')[0]}", 'source_system': "@last(split(triggerBody().folderPath,'/'))", 'suffix': "@last(split(triggerBody().fileName,'.'))", 'switch': "@{last(split(triggerBody().folderPath,'/'))}_@{last(split(triggerBody().fileName,'.'))}" } pipeline_reference = PipelineReference(reference_name=pipeline_name) pipeline_ref = TriggerPipelineReference(pipeline_reference=pipeline_reference, parameters=parameters) model = BlobEventsTrigger(pipelines=[self.pipeline_reference], blob_path_begins_with='/raw/blobs/current', blob_path_ends_with='', ignore_empty_blobs=True, events=[BlobEventTypesEnum.MICROSOFT_STORAGE_BLOB_CREATED], scope=storage_account_id) trigger_resource = TriggerResource(properties=model) client.triggers.create_or_update(rg_name, adf_name, triger_name, trigger_resource) ``` I tried using `.validate()` on the BlobEventsTrigger and the TriggerResource and both are fine. I could create LinkedServices, Datasets and Pipelines but no Triggers - I have the same issue with TumblingWindowTrigger. Am I missing something or are the Triggers in the current version not stable? --- #### Document Details ⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.* * ID: 3a5ccb5b-e5c9-9929-4288-461d18173c32 * Version Independent ID: 5c758589-5285-8065-ff2b-58a1e57b2e4e * Content: [azure.mgmt.datafactory.operations.TriggersOperations class](https://docs.microsoft.com/en-us/python/api/azure-mgmt-datafactory/azure.mgmt.datafactory.operations.triggersoperations?view=azure-python#create-or-update-resource-group-name--factory-name--trigger-name--trigger--if-match-none----kwargs-) * Content Source: [docs-ref-autogen/azure-mgmt-datafactory/azure.mgmt.datafactory.operations.TriggersOperations.yml](https://github.com/MicrosoftDocs/azure-docs-sdk-python/blob/master/docs-ref-autogen/azure-mgmt-datafactory/azure.mgmt.datafactory.operations.TriggersOperations.yml) * GitHub Login: @lmazuel * Microsoft Alias: **lmazuel**
Author: schmocker
Assignees: -
Labels: `Data Factory`, `Docs`, `Mgmt`, `Service Attention`, `customer-reported`, `needs-triage`, `question`
Milestone: -
shawnxzq commented 3 years ago

@schmocker Good to know your issue resolved and good findings, we will look into the errors.

@xiangyan99 Looks like the error message is very generic and not related the specific API, is there anything to do from general python SDK perspective to get more specific errors?

lmazuel commented 3 years ago

The exception not being precise enough is tracked here: https://github.com/Azure/azure-sdk-for-python/issues/14909

Closing since the root cause of the issue is fixed. Thanks!