Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Sep 30, 2024
1 parent 2f841bb commit 06cfe9b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/config/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const (

// TODO: Add Databricks here when it's live.
var ValidDestinations = []DestinationKind{
Databricks,
BigQuery,
MSSQL,
Redshift,
Expand Down
13 changes: 7 additions & 6 deletions lib/config/destination_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ type Snowflake struct {
}

type Databricks struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Database string `yaml:"database"`
Protocol string `yaml:"protocol"`
Host string `yaml:"host"`
Port int `yaml:"port"`
PersonalAccessToken string `yaml:"personalAccessToken"`
Database string `yaml:"database"`
Protocol string `yaml:"protocol"`
CatalogName string `yaml:"catalogName"`
SchemaName string `yaml:"schemaName"`
}
19 changes: 11 additions & 8 deletions lib/config/destinations.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ func (s Snowflake) ToConfig() (*gosnowflake.Config, error) {
}

func (d Databricks) DSN() string {
return fmt.Sprintf("%s://%s:%s@%s:%d/%s",
d.Protocol,
url.QueryEscape(d.Username),
url.QueryEscape(d.Password),
d.Host,
d.Port,
d.Database,
)
query := url.Values{}
query.Add("catalog", d.CatalogName)
query.Add("schema", d.SchemaName)
u := &url.URL{
Scheme: "databricks",
User: url.UserPassword("token", d.PersonalAccessToken),
Host: fmt.Sprintf("%s:%d", d.Host, d.Port),
RawQuery: query.Encode(),
}

return u.String()
}

0 comments on commit 06cfe9b

Please sign in to comment.