m-kovalsky / fabric_cat_tools

Supercharge your Microsoft Fabric development with the fabric_cat_tools library
MIT License
100 stars 14 forks source link

bug in list_warehouses function #10

Closed R1k91 closed 1 month ago

R1k91 commented 1 month ago

the function is not exposed yet but there're bugs in it:

I think the right code is: ` def list_warehouses(workspace = None):

"""

Documentation is available here: https://github.com/m-kovalsky/fabric_cat_tools?tab=readme-ov-file#list_warehouses

"""

df = pd.DataFrame(columns=['Warehouse Name', 'Warehouse ID', 'Description', 'Connection Info', 'Created Date', 'Last Updated Time'])

if workspace == None:
    workspace_id = fabric.get_workspace_id()
    workspace = fabric.resolve_workspace_name(workspace_id)
else:
    workspace_id = fabric.resolve_workspace_id(workspace)

client = fabric.FabricRestClient()
response = client.get(f"/v1/workspaces/{workspace_id}/warehouses/")

for v in response.json()['value']:
    warehouse_id = v['id']
    warehouse_name = v['displayName']
    desc = v['description']
    prop = v['properties']
    connInfo = prop['connectionInfo']
    createdDate = prop['createdDate']
    lastUpdate = prop['lastUpdatedTime']

    new_data = {'Warehouse Name': warehouse_name, 'Warehouse ID': warehouse_id, 'Description': desc, 'Connection Info': connInfo, 'Created Date': createdDate, 'Last Updated Time': lastUpdate}
    df = pd.concat([df, pd.DataFrame(new_data, index=[0])], ignore_index=True)

return df

`

m-kovalsky commented 1 month ago

Ah, my mistake. This fix will go out in the next release. Thanks for reporting.

m-kovalsky commented 1 month ago

This is resolved in 0.4.0