databricks-sdk-go icon indicating copy to clipboard operation
databricks-sdk-go copied to clipboard

More than one authorization method configured

Open maodijim opened this issue 2 years ago • 1 comments

SDK version: v0.2.0

Trying out the https://github.com/databricks/databricks-sdk-go#databricks-native-authentication example but keep getting the more than one authorization method configured error

After going over the code I found that the client will always try to load the cred in ~/.databrickscfg even the token and host have already provided because the KnownConfigLoader always added to config loader https://github.com/databricks/databricks-sdk-go/blob/d7fb9434f72aaab2e352cb1e51a9b30842be0230/config/config.go#L160

and fill in the username and password fields in databricks.Config https://github.com/databricks/databricks-sdk-go/blob/d7fb9434f72aaab2e352cb1e51a9b30842be0230/config/config_file.go#L18

I end up force the client to load a non-existing config file

wc, err := databricks.NewWorkspaceClient(&databricks.Config{
		Host:        "https://***.cloud.databricks.com",
		Token:       "***",
		Credentials: config.PatCredentials{},
		ConfigFile:  "skipConfigFile",
})

Is this a known issue or am I missing something?

maodijim avatar Jan 23 '23 21:01 maodijim

@maodijim , does the following configuration form work, without ConfigFile?.. if it doesn't - then it's definitely a bug and we'll adjust the logic.

wc, err := databricks.NewWorkspaceClient(&databricks.Config{
		Host:        "https://***.cloud.databricks.com",
		Token:       "***",
		Credentials: config.PatCredentials{},
})

mostly likely you have DEFAULT profile in ~/.databrickscfg, right?

nfx avatar Feb 03 '23 13:02 nfx