Databricks Data Engineer Professional exam dumps

Databricks Data Engineer Professional practice question 260 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 260

Select 3

You are tasked with refactoring a Databricks notebook that currently uses a notebook dependency pattern. The notebook imports functions from other notebooks using %run. To improve maintainability and modularity, you decide to adapt this pattern to use Python file dependencies. Which of the following steps should you take to achieve this?

  1. A

    Convert the dependent notebooks into Python files and store them in a Databricks Repos folder.

  2. B

    Use the dbutils.library.install command to install the Python files as libraries.

  3. C

    Add the folder containing the Python files to the Python path using sys.path.append.

  4. D

    Replace %run statements with standard Python import statements to reference functions in the Python files.

  5. E

    Enable the Python file dependencies by configuring the cluster to recognize the .py files.

Show answer and explanation

Correct answers: A, C, D

Explanation

To adapt a notebook dependency pattern to use Python file dependencies in Databricks, you must first convert the dependent notebooks into Python files, manage their paths, and replace %run with Python's import statements. These steps ensure better modularity, maintainability, and compatibility with standard Python practices.

  • A. Correct.

    Correct. Converting dependent notebooks into Python files ensures the dependencies are modular and reusable, which is the goal of this refactor.

  • B. Incorrect.

    Incorrect. dbutils.library.install is not a valid command for managing Python file dependencies in Databricks. Libraries are typically managed through init scripts or package managers like pip.

  • C. Correct.

    Correct. Adding the folder containing the Python files to the Python path ensures that Python can locate and import the files.

  • D. Correct.

    Correct. Replacing %run statements with import statements is necessary to adapt the notebook dependency pattern to Python file dependencies.

  • E. Incorrect.

    Incorrect. There is no need to configure the cluster specifically to recognize .py files. Databricks automatically supports Python files.

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