dbx icon indicating copy to clipboard operation
dbx copied to clipboard

Command dbx sync dbfs does not respect the credentials passed thru env variables

Open kfot opened this issue 2 years ago • 2 comments

Expected Behavior

Make the dbx sync dbfs respects the same standard variables as the databricks-cli and make it consistent with its own tutorial describing usage of DATABRICKS_HOST and DATABRICKS_TOKEN env variables as an authentication alternative to .databrickscfg file.

Current Behavior

Having sourced valid DATABRICKS_HOST and DATABRICKS_TOKEN into the shell and the .databrickscfg file missing, the command raises following error.

$ dbx sync dbfs --include test --dest /user/kfot
Usage: dbx sync dbfs [OPTIONS]
Try 'dbx sync dbfs --help' for help.
╭─ Error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Could not find a databricks-cli config for profile DEFAULT                                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Your Environment

  • dbx version used: 0.7.6 (latest)

kfot avatar Oct 06 '22 12:10 kfot

The problem lies in the handling of the dbx default values in the dbfs and repo functions. The profile param value defaults to "DEFAULT" string

def(
    ...,
    profile: str = PROFILE_OPTION,
    ...,
):

(because the PROFILE_OPTION defined here references the databricks-cli default profile value defined here...)

Then, within the dbfs and repo functions (two identical code sections), the value is passed to the get_databricks_config function (which has misleading profile=None signature) and then in the body the function considers our "DEFAULT" profile value as a valid, explicitly provided profile which it is clearly not.

        if profile:
            config = ProfileConfigProvider(profile).get_config()  <- our guy ends up here
        else:
            config = get_config()                                 <- while it should go right here

kfot avatar Oct 06 '22 13:10 kfot

Is there any progress on resolving this? This bug makes it very difficult to use dbx sync in a CICD setting, and cost significant time troubleshooting before discovering this issue.

doug-cresswell avatar Jul 07 '23 14:07 doug-cresswell