Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2024 11:36 PM - edited 06-15-2024 11:38 PM
Could you please provide guidance on the correct way to dynamically import a Python module from a user-specific path in Databricks Repos? Any advice on resolving the ModuleNotFoundError would be greatly appreciated.
udf_check_table_exists notebook:
from pyspark.sql.utils import AnalysisException
import os
import sys
def table_exists(table_name):
try:
spark.table(table_name)
return True
except AnalysisException:
return False
Error ModuleNotFoundError: No module named 'udf_check_table_exists' with another notebook:
import os
import sys
sys.path.append(os.path.abspath('/Workspace/Repos/[my repo]/dw/common_helper'))
from udf_check_table_exists import table_exists
Thank you for your assistance.