Thanks for using Microsoft Q&A forum and posting your query.
It looks like you’re encountering a common issue when querying Delta Lake files in Azure Synapse. The error message “Content of directory on path cannot be listed” typically indicates a problem with permissions or the structure of the files.
Here are a few things you can check to troubleshoot this issue:
- Permissions: Ensure that your Azure Synapse workspace has the necessary permissions to access the Delta Lake files. You might need to set up server-scoped credentials or database-scoped credentials with a Managed Identity or Shared Access Signature (SAS) that includes both Read and List permissions.
- File Structure: Verify that the Delta Lake folder structure is correct. The root folder should contain a
_delta_log
directory. If this folder is missing, it may not be recognized as a Delta Lake format. - Schema Consistency: If you’re querying multiple files, ensure that all files have the same schema. Inconsistent schemas can lead to errors when trying to read from a directory.
- Query Syntax: When using the
OPENROWSET
function, make sure you’re pointing to the correct path and specifying the format asDELTA
. For example:SELECT * FROM OPENROWSET(BULK 'https://your-path-to-delta/', FORMAT='delta') AS rows;
- Check for Hidden Files: Sometimes, hidden files or success markers can cause issues. Ensure that there are no unexpected files in the directory that might interfere with the query.
Hope this helps. Do let us know if you any further queries.