Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.7.0 Compat #499

Merged
merged 9 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
DBT_DATABRICKS_CLIENT_ID: ${{ secrets.TEST_PECO_SP_ID }}
DBT_DATABRICKS_CLIENT_SECRET: ${{ secrets.TEST_PECO_SP_SECRET }}
DBT_DATABRICKS_UC_INITIAL_CATALOG: peco
DBT_DATABRICKS_LOCATION_ROOT: ${{ secrets.TEST_PECO_EXTERNAL_LOCATION }}
DBT_DATABRICKS_LOCATION_ROOT: ${{ secrets.TEST_PECO_EXTERNAL_LOCATION }}test
TEST_PECO_UC_CLUSTER_ID: ${{ secrets.TEST_PECO_UC_CLUSTER_ID }}
steps:
- name: Check out repository
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
DBT_DATABRICKS_CLIENT_SECRET: ${{ secrets.TEST_PECO_SP_SECRET }}
DBT_DATABRICKS_HTTP_PATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
DBT_DATABRICKS_UC_INITIAL_CATALOG: peco
DBT_DATABRICKS_LOCATION_ROOT: ${{ secrets.TEST_PECO_EXTERNAL_LOCATION }}
DBT_DATABRICKS_LOCATION_ROOT: ${{ secrets.TEST_PECO_EXTERNAL_LOCATION }}test
TEST_PECO_UC_CLUSTER_ID: ${{ secrets.TEST_PECO_UC_CLUSTER_ID }}
steps:
- name: Check out repository
Expand All @@ -67,7 +67,7 @@ jobs:
DBT_DATABRICKS_HOST_NAME: ${{ secrets.DATABRICKS_HOST }}
DBT_DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
TEST_PECO_CLUSTER_ID: ${{ secrets.TEST_PECO_CLUSTER_ID }}
DBT_DATABRICKS_LOCATION_ROOT: ${{ secrets.TEST_PECO_EXTERNAL_LOCATION }}
DBT_DATABRICKS_LOCATION_ROOT: ${{ secrets.TEST_PECO_EXTERNAL_LOCATION }}test
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/databricks/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: str = "1.7.0rc1"
version: str = "1.7.0"
11 changes: 7 additions & 4 deletions dbt/adapters/databricks/impl.py
benc-db marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,15 @@ def parse_columns_from_information( # type: ignore[override]
columns.append(column)
return columns

def get_catalog(
self, manifest: Manifest, selected_nodes: Optional[Set] = None
def get_catalog(self, manifest: Manifest) -> Tuple[Table, List[Exception]]:
catalog_relations = self._get_catalog_relations(manifest)
return self.get_catalog_by_relations(manifest, catalog_relations)

def get_catalog_by_relations(
self, manifest: Manifest, relations: Set[BaseRelation] = None
) -> Tuple[Table, List[Exception]]:
with executor(self.config) as tpe:
catalog_relations = self._get_catalog_relations(manifest, selected_nodes)
relations_by_catalog = self._get_catalog_relations_by_info_schema(catalog_relations)
relations_by_catalog = self._get_catalog_relations_by_info_schema(relations)

futures: List[Future[Table]] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

{% set batch_size = get_batch_size() %}
{% set column_override = model['config'].get('column_types', {}) %}
{% set must_cast = model['config'].get("file_format", "delta") == "parquet" %}

{% set statements = [] %}

Expand All @@ -20,7 +21,13 @@
insert {% if loop.index0 == 0 -%} overwrite {% else -%} into {% endif -%} {{ this.render() }} values
{% for row in chunk -%}
({%- for col_name in agate_table.column_names -%}
{{ get_binding_char() }}
{%- if must_cast -%}
{%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}
{%- set type = column_override.get(col_name, inferred_type) -%}
cast({{ get_binding_char() }} as {{type}})
{%- else -%}
{{ get_binding_char() }}
{%- endif -%}
{%- if not loop.last%},{%- endif %}
{%- endfor -%})
{%- if not loop.last%},{%- endif %}
Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ tox>=3.2.0
types-requests
types-mock

dbt-core==1.7.0rc1
dbt-tests-adapter==1.7.0rc1
dbt-core==1.7.1
dbt-tests-adapter==1.7.1
# git+https://github.com/dbt-labs/[email protected]#egg=dbt-spark
# git+https://github.com/dbt-labs/[email protected]#egg=dbt-core&subdirectory=core
# git+https://github.com/dbt-labs/[email protected]#egg=dbt-tests-adapter&subdirectory=tests/adapter
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
databricks-sql-connector>=2.9.3, <3.0.0
dbt-spark==1.7.0rc1
dbt-spark==1.7.0
databricks-sdk==0.9.0
keyring>=23.13.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _get_plugin_version():
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
include_package_data=True,
install_requires=[
"dbt-spark==1.7.0rc1",
"dbt-spark==1.7.0",
"databricks-sql-connector>=2.9.3, <3.0.0",
"databricks-sdk>=0.9.0",
"keyring>=23.13.0",
Expand Down
Loading