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.53k stars 2.76k forks source link

Request: Include Enum for Types of Data Flows in the Data Factory #26542

Closed mindlessroman closed 1 year ago

mindlessroman commented 1 year ago

Is your feature request related to a problem? Please describe. Instead of needing to expose a protected list of Data Flow types in sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py because it's bad practice to access protected properties/methods.

Describe the solution you'd like It would be nice if there was an enum that was accessible sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py

Describe alternatives you've considered Hardcoding the list is less desirable since things could change in the future and that's more code to update elsewhere.

Additional context n/a

msyyc commented 1 year ago

Hi @mindlessroman, you can import enum variable directly by from azure.mgmt.datafactory.models import AmazonRdsForOraclePartitionOption since it has been in __all__ of __init__.py: https://github.com/Azure/azure-sdk-for-python/blob/b061c2864632a7fc827f5320cadc8c98d2dd0586/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/__init__.py#L728-L733

ghost commented 1 year ago

Hi @mindlessroman. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

mindlessroman commented 1 year ago

/unresolve

mindlessroman commented 1 year ago

Hey @msyyc - I don't think that the enum exists right now.

https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py Line 18938:

You probably want to use the sub-classes and not this class directly. Known sub-classes are: Flowlet, MappingDataFlow, WranglingDataFlow

An enum that contains those subtypes does not exist in sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_data_factory_management_client_enums.py

Having these be in an Enum would be helpful for changes I'm trying to support in https://github.com/Azure/azure-cli-extensions/pull/5407.

msyyc commented 1 year ago

@mindlessroman SDK is generated with swagger. If you want to use these values as enum, there shall be relative enum definition in swagger. Unfortunately, I don't find it in swagger. So I advise you open an issue in https://github.com/Azure/azure-rest-api-specs/issues or make a PR to add it. (enum definition sample: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/datafactory.json#L5105-L5110)

mindlessroman commented 1 year ago

@msyyc - Excellent, thank you for the example! I'll connect there.

ghost commented 1 year ago

Hi @mindlessroman. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

ghost commented 1 year ago

Hi @mindlessroman, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.