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

Fix for run and docs generate on Panoply Redshift #1686

Merged
merged 1 commit into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 7 additions & 5 deletions plugins/postgres/dbt/include/postgres/macros/relations.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{% macro postgres_get_relations () -%}

{#
-- in pg_depend, objid is the dependent, refobjid is the referenced object
-- > a pg_depend entry indicates that the referenced object cannot be
-- > dropped without also dropping the dependent object.
#}

{%- call statement('relations', fetch_result=True) -%}
-- {#
-- in pg_depend, objid is the dependent, refobjid is the referenced object
-- "a pg_depend entry indicates that the referenced object cannot be dropped without also dropping the dependent object."
-- #}
-- {# this only works with the current database #}
with relation as (
select
pg_rewrite.ev_class as class,
Expand Down
2 changes: 1 addition & 1 deletion plugins/redshift/dbt/include/redshift/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
numeric_precision,
numeric_scale

from {{ relation.information_schema('columns') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how confident are you that this is equivalent

Copy link
Contributor Author

@drewbanin drewbanin Aug 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - should be the same thing. This is definitely not equivalent on BQ/Snowflake, but on Redshift, you can only access the information_schema for the database that you're connected to. Turns out Redshift ignores capitalization in even quoted identifiers, so all of these are equivalent 🙃

select * from information_schema.columns;
select * from information_schema."columns";
select * from information_schema."COLUMNS";

from information_schema."columns"
where table_name = '{{ relation.identifier }}'
),

Expand Down
6 changes: 3 additions & 3 deletions plugins/redshift/dbt/include/redshift/macros/catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

),

columns as (
table_columns as (

select
'{{ database }}'::varchar as table_database,
Expand All @@ -74,15 +74,15 @@
null::varchar as column_comment


from information_schema.columns
from information_schema."columns"

),

unioned as (

select *
from tables
join columns using (table_database, table_schema, table_name)
join table_columns using (table_database, table_schema, table_name)

union all

Expand Down