diff --git a/CHANGELOG.md b/CHANGELOG.md index 8223bb66f..35fe2a0ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/dbt/adapters/firebolt/__version__.py b/dbt/adapters/firebolt/__version__.py index 3fd4981d4..c34baa9c7 100644 --- a/dbt/adapters/firebolt/__version__.py +++ b/dbt/adapters/firebolt/__version__.py @@ -1 +1 @@ -version = "0.21.1" +version = "0.21.2" diff --git a/dbt/adapters/firebolt/connections.py b/dbt/adapters/firebolt/connections.py index 84343b153..ee67d1659 100644 --- a/dbt/adapters/firebolt/connections.py +++ b/dbt/adapters/firebolt/connections.py @@ -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 @@ -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. @@ -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) diff --git a/dev-requirements.txt b/dev-requirements.txt index 749d783f5..3d1060981 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ pytest~=0.6.2 pytest-dbt-adapter==0.5.1 -dbt-core~=0.20.0 +dbt-core~=0.21.0 . \ No newline at end of file