Closed jasonicarter closed 3 years ago
Hey @jasonicarter, could you try out the changes in #59? I'm not in love with my approach, but I'm hopeful that it resolves this bug in the short term:
packages:
- git: https://github.com/fishtown-analytics/dbt-external-tables
revision: fix/redshift-multipartitioned
Hey @jasonicarter, could you try out the changes in #59? I'm not in love with my approach, but I'm hopeful that it resolves this bug in the short term:
packages: - git: https://github.com/fishtown-analytics/dbt-external-tables revision: fix/redshift-multipartitioned
Hi @jtcohen6 , I can confirm the package change above successfully created and altered the external table. Using the same sources.yml as in the original issue, please see the dbt.log
snippet below...
begin; commit; alter table "prod"."spectrum_schema"."spectrum_table" add if not exists partition (num_one='2020', num_two='11', num_three='10') location 's3://my_bucket/num_one=2020/num_two=11/num_three=10/'
Describe the bug
Alter table statement (Redshift) missing partition statements. It appears to only use the first and last defined partitions in the sources.yml file. I've tried it a number of times with different number of partitions (always the 1st and last shown in dbt.logs)
Steps to reproduce
(this was my original setup, the test yml below is a simplified version which causes the same error) My setup using AWS Glue so I'll try to include everything I did...
s3://my_bucket/type=subject_1/year=2020/month=11/day=29/hour=01
(after some testing it appears this doesn't matter).AWS Glue
setup a crawler with the "top level split" being the table name. This gives you a table name of "subject_1" with data having partitions year, month and day (data is already partitioned by Glue - probably usingexternal-tables
is redundant but besides the point for this issue).select values, location from svv_external_partitions where tablename = 'type_subject_1'
you'll get something likevalues = ["2020","11","29","01"]
andlocation = s3://my_bucket/type=subject_1/year=2020/month=11/day=29/hour=01/
dbt run-operation stage_external_sources --vars 'ext_full_refresh: true'
(yml snippet below)Expected results
A new external table should be created with the correct paritions
Actual results
Operation failed. Table created with correct columns but an error message -
Encountered an error while running operation: Database Error The number of partition keys do not match the number of partition values
Screenshots and log output
dbt.log Create external table (created correctly in db)
Alter table (error occurs)
System information
The contents of your
packages.yml
file: packages:Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using: macOS Cataline v10.15.7
Additional context
test yml file