diff --git a/project/config.go b/project/config.go index 344a2221..4b28f7f7 100644 --- a/project/config.go +++ b/project/config.go @@ -77,7 +77,16 @@ func IsDatabricksProject() bool { } func loadProjectConf(root string) (c Config, err error) { - config, err := os.Open(filepath.Join(root, ConfigFile)) + configFilePath := filepath.Join(root, ConfigFile) + + if _, err := os.Stat(configFilePath); errors.Is(err, os.ErrNotExist) { + baseDir := filepath.Base(root) + // If bricks config file is missing we assume the project root dir name + // as the name of the project + return Config{Name: baseDir}, nil + } + + config, err := os.Open(configFilePath) if err != nil { return } diff --git a/project/project.go b/project/project.go index cdf2ade6..3a9dd24b 100644 --- a/project/project.go +++ b/project/project.go @@ -58,7 +58,16 @@ func Initialize(ctx context.Context, root string) (context.Context, error) { config: &config, } - p.wsc = workspaces.New(&databricks.Config{Profile: config.Profile}) + if config.Profile == "" { + // Bricks config doesn't define the profile to use, so go sdk will figure + // out the auth credentials based on the enviroment. + // eg. DATABRICKS_CONFIG_PROFILE can be used to select which profile to use or + // DATABRICKS_HOST and DATABRICKS_TOKEN can be used to set the workspace auth creds + p.wsc = workspaces.New() + } else { + p.wsc = workspaces.New(&databricks.Config{Profile: config.Profile}) + } + return context.WithValue(ctx, &projectKey, &p), nil }