Forum Discussion
Cannot use spark.catalog.listTables in notebook
- 1 year ago
Thankyou, BhaveshPatel, for your response.
Hi dbeavon3,We appreciate your inquiry submitted through the Microsoft Fabric Community Forum.
As per my understanding, the error “[PARSE_SYNTAX_ERROR] Syntax error at or near end of input” may occur if the default Lakehouse is not attached, if the Lakehouse is schema enabled which is a known limitation with certain Spark catalog APIs or due to the parsing behavior of Python 3.11 and Delta 3.2 generating invalid SQL for spark.catalog.listTables().
Kindly follow the steps below to resolve the issue:
- Check the default database using spark.catalog.currentDatabase(). If this returns an error or shows default with no tables, you will need to specify your Lakehouse name explicitly.
- List the available databases using spark.catalog.listDatabases(). Confirm that your Lakehouse name is present in the list.
- Explicitly list tables from the Lakehouse by using spark.catalog.listTables("YourLakehouseName"). Please replace YourLakehouseName with the actual name of your Lakehouse.
- Ensure that the notebook has the correct default Lakehouse attached.
Please find the attached screenshot regarding the schema enabled Lakehouse limitation:
Additionally, kindly refer to the following link for more information:
Lakehouse schemas (Preview) - Microsoft Fabric | Microsoft LearnWe hope that the above information will assist in resolving the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric Community.
Thank you.
Hi dbeavon3,
We would like to follow up and see whether the details we shared have resolved your problem.
If you need any more assistance, please feel free to connect with the Microsoft Fabric community.
Thank you.