-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add AWS Athena plugin #133
Closed
daniel-cortez-stevenson
wants to merge
3
commits into
dbt-labs:main
from
daniel-cortez-stevenson:main
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,18 @@ orbs: | |
azure-cli: circleci/[email protected] | ||
|
||
jobs: | ||
|
||
|
||
integration-athena: | ||
docker: | ||
- image: cimg/python:3.9.9 | ||
steps: | ||
- checkout | ||
- run: | ||
name: "Run Tests - Athena" | ||
command: ./run_test.sh athena | ||
- store_artifacts: | ||
path: ./logs | ||
|
||
integration-redshift: | ||
docker: | ||
- image: cimg/python:3.9.9 | ||
|
@@ -111,6 +122,7 @@ workflows: | |
- integration-snowflake | ||
- integration-bigquery | ||
- integration-databricks | ||
- integration-athena | ||
#- integration-synapse | ||
#- integration-azuresql: | ||
# requires: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
integration_tests/models/plugins/athena/athena_external.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: athena_external | ||
schema: "{{ target.schema }}" | ||
tables: | ||
- name: people_csv_unpartitioned | ||
external: &csv-people | ||
location: "s3://dbt-external-tables-testing/csv/" | ||
row_format: serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde' | ||
table_properties: "('skip.header.line.count'='1')" | ||
columns: &cols-of-the-people | ||
- name: id | ||
data_type: int | ||
- name: first_name | ||
data_type: varchar(64) | ||
- name: last_name | ||
data_type: varchar(64) | ||
- name: email | ||
data_type: varchar(64) | ||
tests: &equal-to-the-people | ||
- dbt_utils.equality: | ||
compare_model: ref('people') | ||
compare_columns: | ||
- id | ||
- first_name | ||
- last_name | ||
|
||
- name: people_csv_partitioned | ||
external: | ||
<<: *csv-people | ||
partitions: &parts-of-the-people | ||
- name: section | ||
data_type: varchar(1) | ||
vals: ['a','b','c','d'] | ||
path_macro: dbt_external_tables.key_value | ||
columns: *cols-of-the-people | ||
tests: *equal-to-the-people | ||
|
||
# ensure that all partitions are created | ||
- name: people_csv_multipartitioned | ||
external: | ||
<<: *csv-people | ||
location: "s3://dbt-external-tables-testing/" | ||
partitions: | ||
- name: file_format | ||
data_type: varchar(4) | ||
vals: ['csv', 'json'] | ||
path_macro: dbt_external_tables.value_only | ||
- name: section | ||
data_type: varchar(1) | ||
vals: ['a','b','c','d'] | ||
path_macro: dbt_external_tables.key_value | ||
- name: some_date | ||
data_type: date | ||
vals: | ||
macro: dbt.dates_in_range | ||
args: | ||
start_date_str: '2020-01-01' | ||
end_date_str: '2020-02-01' | ||
in_fmt: "%Y-%m-%d" | ||
out_fmt: "%Y-%m-%d" | ||
path_macro: dbt_external_tables.year_month_day | ||
- name: file_name | ||
data_type: varchar(10) | ||
vals: ['people', 'not_people'] | ||
path_macro: dbt_external_tables.value_only | ||
columns: *cols-of-the-people | ||
|
||
- name: people_csv_multipartitioned_hive_compatible | ||
external: | ||
<<: *csv-people | ||
hive_compatible_partitions: true | ||
location: "s3://dbt-external-tables-testing/" | ||
partitions: | ||
- name: file_format | ||
data_type: varchar(4) | ||
vals: ['csv', 'json'] | ||
path_macro: dbt_external_tables.value_only | ||
- name: section | ||
data_type: varchar(1) | ||
vals: ['a','b','c','d'] | ||
path_macro: dbt_external_tables.key_value | ||
- name: some_date | ||
data_type: date | ||
vals: | ||
macro: dbt.dates_in_range | ||
args: | ||
start_date_str: '2020-01-01' | ||
end_date_str: '2020-02-01' | ||
in_fmt: "%Y-%m-%d" | ||
out_fmt: "%Y-%m-%d" | ||
path_macro: dbt_external_tables.year_month_day | ||
- name: file_name | ||
data_type: varchar(10) | ||
vals: ['people', 'not_people'] | ||
path_macro: dbt_external_tables.value_only | ||
columns: *cols-of-the-people | ||
|
||
- name: people_json_unpartitioned | ||
external: &json-people | ||
location: "s3://dbt-external-tables-testing/json/" | ||
row_format: "serde 'org.openx.data.jsonserde.JsonSerDe' | ||
with serdeproperties ( | ||
'strip.outer.array'='false' | ||
)" | ||
columns: *cols-of-the-people | ||
tests: *equal-to-the-people | ||
|
||
- name: people_json_partitioned | ||
external: | ||
<<: *json-people | ||
partitions: *parts-of-the-people | ||
columns: *cols-of-the-people | ||
tests: *equal-to-the-people |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is something the adapter can reimplement! That's where the logic lives, with just this sort of reason in mind. The base implementation is defined on the core adapter interface:
_QueryComment.add()
incore.dbt.adapters.base.query_headers
The right place for this is probably a new issue in the
dbt-athena
adapterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks for the pointer! I've opened up a PR in the dbt-athena adapter repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniel-cortez-stevenson Could you please add a link to your PR? I cannot find it and need inspiration for how to solve a similar issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm. found it: Tomme/dbt-athena#64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of it?