fabric_cat_tools icon indicating copy to clipboard operation
fabric_cat_tools copied to clipboard

bug in list_warehouses function

Open R1k91 opened this issue 9 months ago • 1 comments

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

  • it doesn't return df
  • it calls an api that doesn't exist

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

`

R1k91 avatar May 07 '24 15:05 R1k91

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

m-kovalsky avatar May 07 '24 15:05 m-kovalsky

This is resolved in 0.4.0

m-kovalsky avatar May 13 '24 06:05 m-kovalsky