Databricks Data Engineer Associate exam dumps

Databricks Data Engineer Associate practice question 201 of 532

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

Databricks Data Engineer Associate Question 201

Single answer

You are working on a Databricks notebook and need to use a custom Python function named transform_data. The function is defined in another file located in a shared workspace repository under the folder path /Workspace/Repos/shared-project/functions/. How would you correctly identify the location of this function and make it usable in your current notebook?

  1. A

    Use %run /Workspace/Repos/shared-project/functions/transform_data to import the function.

  2. B

    Use import /Workspace/Repos/shared-project/functions/transform_data to import the function.

  3. C

    Use %run /Workspace/Repos/shared-project/functions to import all functions in the folder, including transform_data.

  4. D

    Use from /Workspace/Repos/shared-project/functions import transform_data to import the function.

Show answer and explanation

Correct answer: A

Explanation

In Databricks, the %run command is used to execute code from another notebook or file so that its contents, including functions, variables, and classes, are accessible in the current notebook. To make the transform_data function usable, you need to specify the exact file path using %run, such as %run /Workspace/Repos/shared-project/functions/transform_data. Other options like import or from ... import are not compatible with workspace paths in Databricks.

  • A. Correct.

    This is the correct way to identify and execute a function defined in another file located in the Databricks workspace. %run executes all the code in the referenced file, making the transform_data function accessible in your notebook.

  • B. Incorrect.

    import cannot be directly used with workspace paths as it is not a valid method for identifying and importing functions in Databricks.

  • C. Incorrect.

    %run with only the folder path will not import the transform_data function specifically. Instead, you need to specify the exact file path to successfully execute the function.

  • D. Incorrect.

    from with the workspace path is not a valid way to import functions from files in Databricks, as it does not recognize workspace paths using this syntax.

Timed practice exam

Take a Databricks Data Engineer Associate practice test under exam conditions

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

Start timed exam