Skip to content

Commit

Permalink
Fixed double underline (#7944)
Browse files Browse the repository at this point in the history
* Fixed double-underline
* backward compatibility postgres_get_relations
* Remove invalid comments
* compatibility adapter and get_relation
* fix generic for call
* fix adapter dispatch grammar issue
  • Loading branch information
lllong33 authored Jul 21, 2023
1 parent 1e2b9ae commit ff5cb7b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230625-142731.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fixed double-underline
time: 2023-06-25T14:27:31.231253719+08:00
custom:
Author: lllong33
Issue: "5301"
9 changes: 9 additions & 0 deletions core/dbt/include/global_project/macros/adapters/metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,12 @@
{{ exceptions.raise_not_implemented(
'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}
{% endmacro %}

{% macro get_relations() %}
{{ return(adapter.dispatch('get_relations', 'dbt')()) }}
{% endmacro %}

{% macro default__get_relations() %}
{{ exceptions.raise_not_implemented(
'get_relations macro not implemented for adapter '+adapter.type()) }}
{% endmacro %}
3 changes: 1 addition & 2 deletions plugins/postgres/dbt/adapters/postgres/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import dbt.utils


# note that this isn't an adapter macro, so just a single underscore
GET_RELATIONS_MACRO_NAME = "postgres_get_relations"
GET_RELATIONS_MACRO_NAME = "postgres__get_relations"


@dataclass
Expand Down
6 changes: 5 additions & 1 deletion plugins/postgres/dbt/include/postgres/macros/relations.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro postgres_get_relations () -%}
{% macro postgres__get_relations() -%}

{#
-- in pg_depend, objid is the dependent, refobjid is the referenced object
Expand Down Expand Up @@ -74,3 +74,7 @@

{{ return(load_result('relations').table) }}
{% endmacro %}

{% macro postgres_get_relations() %}
{{ return(postgres__get_relations()) }}
{% endmacro %}

0 comments on commit ff5cb7b

Please sign in to comment.