Skip to content

Commit

Permalink
Merge branch 'main' into issue-337-redo
Browse files Browse the repository at this point in the history
This fixes a merge conflict in the changelog

Signed-off-by: Jesse Whitehouse <[email protected]>
  • Loading branch information
Jesse Whitehouse committed Jan 17, 2024
2 parents 23f4880 + f714873 commit 5443112
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Added python model specific connection handling to prevent using invalid sessions ([547](https://github.com/databricks/dbt-databricks/pull/547))
- Allow schema to be specified in testing (thanks @case-k-git!) ([538](https://github.com/databricks/dbt-databricks/pull/538))
- Fix dbt incremental_strategy behavior by fixing schema table existing check (thanks @case-k-git!) ([530](https://github.com/databricks/dbt-databricks/pull/530))
- Fixed bug that was causing streaming tables to be dropped and recreated instead of refreshed. ([552](https://github.com/databricks/dbt-databricks/pull/552))
- Fix: Python models authentication could be overridden by a `.netrc` file in the user's home directory ([338](https://github.com/databricks/dbt-databricks/pull/338))

### Under the Hood
Expand Down
15 changes: 12 additions & 3 deletions dbt/adapters/databricks/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
from dbt.adapters.base.impl import catch_as_completed
from dbt.adapters.base.meta import available
from dbt.adapters.base.relation import BaseRelation, InformationSchema
from dbt.adapters.capability import CapabilityDict, CapabilitySupport, Support, Capability
from dbt.adapters.capability import (
CapabilityDict,
CapabilitySupport,
Support,
Capability,
)
from dbt.adapters.spark.impl import (
SparkAdapter,
GET_COLUMNS_IN_RELATION_RAW_MACRO_NAME,
Expand Down Expand Up @@ -286,7 +291,8 @@ def get_relations_without_caching(self, relation: DatabricksRelation) -> Table:
with self._catalog(relation.database):
views = self.execute_macro(SHOW_VIEWS_MACRO_NAME, kwargs=kwargs)
tables = self.execute_macro(
SHOW_TABLE_EXTENDED_MACRO_NAME, kwargs={"schema_relation": relation_all_tables}
SHOW_TABLE_EXTENDED_MACRO_NAME,
kwargs={"schema_relation": relation_all_tables},
)
view_names: Dict[str, bool] = {
view["viewName"]: view.get("isMaterialized", False) for view in views
Expand Down Expand Up @@ -319,8 +325,11 @@ def get_relations_without_caching(self, relation: DatabricksRelation) -> Table:

def _parse_type(self, information: str) -> str:
type_entry = [
entry.strip() for entry in information.split("\n") if entry.split(":")[0] == "Type"
entry.split(":")[1].strip()
for entry in information.split("\n")
if entry.startswith("Type:")
]

return type_entry[0] if type_entry else ""

def _type_from_names(
Expand Down
6 changes: 6 additions & 0 deletions dbt/include/databricks/macros/relations/drop.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@
{%- else -%}
{{ drop_table(relation) }}
{%- endif -%}
{% endmacro %}

{% macro databricks__drop_relation(relation) -%}
{% call statement('drop_relation', auto_begin=False) -%}
{{ get_drop_sql(relation) }}
{%- endcall %}
{% endmacro %}

0 comments on commit 5443112

Please sign in to comment.