Bertverbeek4PS / bc2adls

Exporting data from Dynamics 365 Business Central to Azure data lake storage or MS Fabric lakehouse
MIT License
60 stars 23 forks source link

Fabric. Writing to workspace with Uppercase letters #132

Closed lhammerbh closed 6 months ago

lhammerbh commented 6 months ago

This is more FYI than an issue, but it may be nice for other people to know.

We are using BC2ADLS in the Fabric version to copy data from BC to Onelake in Microsoft Fabric. This worked really well until last Friday (17. may 2024), where it started failing. Most likely due to an update in Microsoft Fabric. The name of the workspace where data was written to, was containing uppercase letters and spaces: GRM BI Datasets. The name of the lakehouse is: grm_bc2adls_lakehouse.

Friday the following error started showing up: image

Also I can see the lakehouse in Azure Storage Explorer: image But when I try to see the data in the lakehouse in Azure Storage Explorer, it fails: image

Our fix has been to move the solution to a new workspace called grm_bi_datasets, i.e. without any uppercase letters and also without any spaces. Everything is working correctly now.

Yours Lars Hammer

y0m0 commented 6 months ago

Good to know I wasn't the only one that stumbled upon this. I spent a couple of hours trying to figure out why it suddenly stopped working.

At the same time I found out that using guid for workspace and lakehouse doesn't work due to the label used to compose the url.

https://onelake.dfs.fabric.microsoft.com/<workspace>/<item>.<itemtype>/<path>/<fileName>

vs

https://onelake.dfs.fabric.microsoft.com/<workspaceGUID>/<itemGUID>/<path>/<fileName>
Bertverbeek4PS commented 6 months ago

Thanks @lhammerbh and @y0m0!! Maybe we must put prevent putting uppercase letters and spaces in Business Central also. Not sure if GUID is user friendly.

Or any thought on that?

greglong1 commented 6 months ago

Have come across the same issue with my customer but it didn't error out on Export as I'm triggering the export in my Fabric pipeline using the BC API. In my development environment a solution also appears to be the following:

  1. Rename Fabric workspace to lower case & without spaces - in Workspace settings
  2. Update BC2ADLS > Export to Azure Data Lake Storage - change Fabric Workspace to new workspace name
  3. Test export and check that new files are placed in the deltas\table folder
  4. Test notebook

This appears to work, but I will perform further testing before deploying to production.

lhammerbh commented 6 months ago

@Bertverbeek4PS For us, it would have been a great solution, if we could use GUID's instead, because we are not in the same position as @greglong1 that could rename the workspace, because we have quite a few other lakehouses and a warehouse in the same workspace. We actually tried, if it worked with GUID's for the workspace name and lakehouse name in the configuration of BC2ADLS in BC, but we got the following error:

Could not read data on

https://onelake.dfs.fabric.microsoft.com/996752af-ef2c-421b-abbf-e0b3865afbb1/76425d10-19dd-4b3d-940a-53843436bd5f.Lakehouse/Files/PaymentTerms-3.cdm.json.
{"error":{"code":"BadRequest","message":"WorkspaceId and ArtifactId should be either valid Guids or valid Names"}}

This indicates that the ".Lakehouse" extension is added in the code and might not be needed.

In general, I think names are more user friendly than GUID's, but on the other hand there are many places, where this is optional.

Bertverbeek4PS commented 6 months ago

@lhammerbh thanks for your reply! Now in the new feature branche you can enter a GUID or a lowercase name. With the export it will find the right URL. So in that case you don't have to rename everything but you can use GUIDS now.

lhammerbh commented 6 months ago

Very nice, @Bertverbeek4PS Highly appreciated, that you are so fast and effective.

greglong1 commented 6 months ago

@lhammerbh @Bertverbeek4PS - thanks for looking at this

Just an update - it appears that the issue only affects spaces in the Workspace name, as it is case insensitive so upper case letters appear to be OK. I have changed the name of our production workspace from "D365BC Production" to "D365BC_Production" with success in exporting the BC table deltas to OneLake.

In this implementation of BC2ADLS for this customer, we have attempted to use a meta data driven approach for all our lake houses. All our abfss lakehouse references are held centrally and in this case use the workspace & lakehouse guids so remained unchanged. It was only the BC2ADLS setup screen and Azure Storage Explorer that referenced the Workspace name and required changing when we changed the Workspace name.

Thanks for bringing this issue to my attention and the great work.

lhammerbh commented 6 months ago

Thanks for being precise about the issue, @greglong1

Bertverbeek4PS commented 6 months ago

Thanks @greglong1. Maybe we need to update the code then for this part to enable also uppercase. Now it is lowercase only for workspace and loakehouse