Skip to content

Commit

Permalink
Merge pull request #5 from firebolt-db/update-jdbc-path-windows
Browse files Browse the repository at this point in the history
Update jdbc path windows
  • Loading branch information
ima-hima authored Nov 1, 2021
2 parents d96b0a6 + 1c86325 commit 52e062b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Changelog

## v.0.21.2

### Breaking Changes

- `engine_name` has been renamed to `engine` please update your `profiles.yml` accordingly [#4](https://github.com/firebolt-db/dbt-firebolt/pull/4)
### Features

- added ability to specify an account for users who have more than one account associated with their credentials [#4](https://github.com/firebolt-db/dbt-firebolt/pull/4)
### Fixes

- fixed bug where database connection URL used backslashes on Windows due to `os.path.join` [#5](https://github.com/firebolt-db/dbt-firebolt/pull/5)


## v.0.21.1

### Fixes

- removed log statements and an extra `firebolt__get_create_index_sql` macro error via [#2](https://github.com/firebolt-db/dbt-firebolt/pull/2)

- added ability to specify an account for users who have more than one account associated with their credentials


## v.0.21.0

Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/firebolt/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.21.1"
version = "0.21.2"
22 changes: 15 additions & 7 deletions dbt/adapters/firebolt/connections.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Optional, Dict, List, Any, Iterable
from urllib.parse import urlencode, quote
from urllib.parse import quote, urlencode
import os
import json
import agate
Expand Down Expand Up @@ -100,9 +100,17 @@ def open(cls, connection):
return connection

def make_jdbc_url(self, credentials):
jdbc_url = os.path.join("jdbc:firebolt://",
credentials.host,
credentials.database)
jdbc_url = f'jdbc:firebolt://{credentials.host}/{credentials.database}'
if credentials.params:
jdbc_url += "".join(
map(
lambda kv: "&"
+ urllib.parse.quote(kv[0])
+ "="
+ urllib.parse.quote(kv[1]),
credentials.params.items(),
)
)
# For both engine name and account, if there's not a value specified
# it uses whatever Firebolt has set as default for this DB. So just
# fill in url variables that are not None.
Expand All @@ -112,9 +120,9 @@ def make_jdbc_url(self, credentials):
}
# If params, then add them, too.
if credentials.params:
url_vars.update({key:quote(credentials.params.items()[key]).lower()
for key in credentials.params.items()
if credentials.params.items()[key]
url_vars.update({key:quote(value).lower()
for key, value in credentials.params.items()
if value
})
if url_vars:
jdbc_url += "?" + urlencode(url_vars)
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest~=0.6.2
pytest-dbt-adapter==0.5.1
dbt-core~=0.20.0
dbt-core~=0.21.0
.

0 comments on commit 52e062b

Please sign in to comment.