Skip to content

Commit

Permalink
Search for both databricks.exe and databricks binaries in windows (#517)
Browse files Browse the repository at this point in the history
## Changes
<!-- Summary of your changes that are easy to understand -->

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [x] `make test` run locally
- [x] `make fmt` applied
- [ ] relevant integration tests applied
  • Loading branch information
kartikgupta-db authored Jan 30, 2024
1 parent fff9a67 commit 4cb9345
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions databricks/sdk/credentials_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os
import pathlib
import platform
import subprocess
import sys
from datetime import datetime
Expand Down Expand Up @@ -473,11 +474,21 @@ def __init__(self, cfg: 'Config'):
args += ['--account-id', cfg.account_id]

cli_path = cfg.databricks_cli_path

# If the path is not specified look for "databricks" / "databricks.exe" in PATH.
if not cli_path:
cli_path = 'databricks'
try:
# Try to find "databricks" in PATH
cli_path = self.__class__._find_executable("databricks")
except FileNotFoundError as e:
# If "databricks" is not found, try to find "databricks.exe" in PATH (Windows)
if platform.system() == "Windows":
cli_path = self.__class__._find_executable("databricks.exe")
else:
raise e

# If the path is unqualified, look it up in PATH.
if cli_path.count("/") == 0:
elif cli_path.count("/") == 0:
cli_path = self.__class__._find_executable(cli_path)

super().__init__(cmd=[cli_path, *args],
Expand Down

0 comments on commit 4cb9345

Please sign in to comment.