Databricks Data Engineer Professional exam dumps

Databricks Data Engineer Professional practice question 265 of 313

Databricks Certified Data Engineer Professional. Professional level, Databricks. Free question with the correct answer and a full explanation.

Databricks Data Engineer Professional Question 265

Select 3

You are maintaining a Databricks project where a shared Python library was previously packaged and distributed as a Wheel (.whl) file. To simplify development and avoid repackaging, you want to adapt the project to use direct imports with relative paths. After making the necessary changes, you notice that the Databricks notebook fails to import a module from the shared library. What steps should you take to resolve this issue?

  1. A

    Ensure the shared library's directory is added to the sys.path in the notebook's initialization code.

  2. B

    Update the notebook's cluster configuration to include the shared library's folder in the PYTHONPATH environment variable.

  3. C

    Convert all absolute imports in the shared library to relative imports based on the new project directory structure.

  4. D

    Revert to using the Wheel file instead, as relative imports are not supported in Databricks.

  5. E

    Verify that the shared library's directory is correctly uploaded to the Databricks workspace or mounted to DBFS.

Show answer and explanation

Correct answers: A, B, E

Explanation

When transitioning from using Wheels to direct imports via relative paths, you must ensure that the shared library is accessible to the Databricks environment. Adding the library's directory to the sys.path and setting the PYTHONPATH environment variable ensures Python can locate the library during runtime. Additionally, the shared library must be available in the Databricks workspace or DBFS so it can be accessed by the cluster.

  • A. Correct.

    Adding the shared library's directory to the sys.path in the notebook ensures that Python can locate the library for imports. This is a common practice when using relative paths for shared code.

  • B. Correct.

    Setting the PYTHONPATH environment variable for the cluster allows Databricks to recognize the shared library's location, making it available for import in notebooks.

  • C. Incorrect.

    Converting absolute imports to relative imports is unnecessary unless the library’s internal structure has changed. The issue described is about Databricks failing to locate the library, not an import type mismatch.

  • D. Incorrect.

    Reverting to the Wheel file is not required, as Databricks supports using relative paths for shared libraries. Reverting would contradict the goal of simplifying development.

  • E. Correct.

    Ensuring the shared library's directory is accessible in the Databricks workspace or DBFS is essential for making the library available to the cluster and notebooks.

Timed practice exam

Take a Databricks Data Engineer Professional practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam