Skip to content
Advertisement

Azure Data Factory HTTP Dataset using Python SDK , unable to find parameters

I am trying to create a HTTP ‘Dataset’ in Data Factory using Python SDK azure.mgmt.datafactory.models. I am unable to find the parameters in Microsoft documentation (https://learn.microsoft.com/en-us/python/api/azure-mgmt-datafactory/azure.mgmt.datafactory.models.httpdataset?view=azure-python) that will provide me the below features that I can see when created manually from portal.

Manual creation (from portal):

Create HTTP Dataset -> Select Format (Excel) -> I get the below page which has additional details – ‘Worksheet mode’, ‘Sheet name’, ‘First row as header’ etc.

Could you please point me to the right documentation/details to add these parameters?

From the link above, the relevant parameters I could fine are linked_service_name and Format (and in Format, I cannot see Excel there, but during manual creation I do see Excel)

enter image description here enter image description here

Advertisement

Answer

You should use ExcelDataset Class not HttpDataset Class. And pass your http linked service reference to ExcelDataset().

Here is my test code, you can have a try:

hl_name = 'HttpServer1'
ds_name = 'http_excel2'
ds_ls = LinkedServiceReference(reference_name=hl_name)
ds_http_excel = DatasetResource(properties=ExcelDataset(linked_service_name=ds_ls,sheet_name='sheet1',first_row_as_header=True))
ds = adf_client.datasets.create_or_update(rg_name, df_name, ds_name, ds_http_excel)

Result: enter image description here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement