-
Notifications
You must be signed in to change notification settings - Fork 64
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
[Bug] adapter.get_columns_in_relation
does not work cross database
#639
Comments
Looks like |
We are running into the same issue. We are trying to create the dbt output in an other database than the source data is located. I tracked it down to this line where Maybe something like this could replace SELECT ordinal_position,
table_name,
column_name,
data_type,
character_maximum_length,
numeric_precision,
numeric_scale
FROM SVV_ALL_COLUMNS WHERE database_name = '<database>' AND schema_name = '<schema>' AND table_name = '<table>' |
@VolkerSchiewe are you also using RA3 nodes? |
yes |
@VolkerSchiewe @jeremyyeo I just opened dbt-labs/dbt-redshift#738, do you want to it's version of |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
@dataders any update on that topic? Have you talked to the redshift team? |
hey @VolkerSchiewe yeah we've been in discussion with them. Have you looked over #637? The consensus between their team and ours right now is that rather than solve one-off issues like this one, we instead holistically address cross-database functionality. Are you on a team currently that would benefit from this feature? If so I can log this internally so we can track interest over time. |
Hey @dataders , my team and I are also facing this same exact issue. We were planning to data shares to get our production tables into a lower environment, but it comes in as a separate database. This would help us tremendously and is a huge blocker for us to get our lower environment setup. |
@bteh the solution for Redshift that I came up with in the meantime is to create a macro like this:
and then call it in your model. |
It seems that this issue also affects codegen's generate_source command (https://github.com/dbt-labs/dbt-codegen/blob/0.12.1/macros/generate_source.sql) |
…639) * update `dev-requirements.txt` to point to the feature branch on `dbt-core` * organized materializations directory * organized materializations directory * added materialized view stubs * added materialized view test case * accounted for ordered lists in test case * changie * updated record type to List[tuple] * updated file structure to new macros structure * reverting to old structure for non-MV relations * reverting to old structure for non-MV relations * reverting to old structure for non-MV relations * updating to move towards adap-400 * remove db api files as shift was considered out of scope * remove strategy files as shift was considered out of scope * point back to main branch as adap-2 has been merged * start to build out base tests and modify input format for some macros * add very rough draft of bigquery version of materialization * continued work on bigquery mat view materialization * eod update * break out MV-relevant macros in adapters.sql into separate files in macros/relations * changie * update `dev-requirements.txt` to point to the feature branch on `dbt-core` * organized materializations directory * organized materializations directory * added materialized view stubs * added materialized view test case * accounted for ordered lists in test case * updated record type to List[tuple] * changie * updated file structure to new macros structure * reverting to old structure for non-MV relations * reverting to old structure for non-MV relations * reverting to old structure for non-MV relations * updating to move towards adap-400 * remove db api files as shift was considered out of scope * remove strategy files as shift was considered out of scope * point back to main branch as adap-2 has been merged * start to build out base tests and modify input format for some macros * add very rough draft of bigquery version of materialization * continued work on bigquery mat view materialization * eod update * fix whitespacing from rebase * point back to dbt-core/main since MVs are merged in dbt-core * fix rebasing misses * revert unrelated test file migration * move materialized view macros into the new macro file structure * refactor after pair, still failing for dropping uncreated backup * pull create or replace view into BQ, added drop statements for replace functionality, fixed signatures on some macros, added new type to adapter class * revert dev-requirements.txt change * implement rename for table and view * updated renameable and replaceable relations * updated renameable and replaceable relations to use default factory * updated renameable and replaceable relations to use frozenset * revert dev-requirements.txt to point back to main --------- Co-authored-by: Matthew McKnight <[email protected]> Co-authored-by: Matthew McKnight <[email protected]>
…rc1 (#639) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nicor88 <[email protected]>
Is this a new bug in dbt-redshift?
Current Behavior
Not too sure if this calls for it's own issue but pretty much an extension of #652 -
adapter.get_columns_in_relation
does not support introspecting a table that is in a different database.Expected Behavior
Just like #652 - we need to make
adapter.get_columns_in_relation
work across databases.Steps To Reproduce
dev
andsources_only
) add 2 tables.dev
:get_columns_in_relation
:^ We didn't manage to retrieve column
id
for the source that is in the other database (sources_only
).The reason for that is straightforward - if we look at the
get_columns_in_relation
implementation and try and run that query straight up in Redshift:Relevant log output
No response
Environment
Additional Context
This results in dbt-labs/dbt-codegen#167 - which further materializes itself in dbt Cloud IDE as users try and use the "generate model" function and find that it doesn't work as expected:
The text was updated successfully, but these errors were encountered: