-
Notifications
You must be signed in to change notification settings - Fork 28
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
Refactor of the Code Base #18
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 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
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,65 @@ | ||
# dbt-vertica Macro Implementations | ||
|
||
Below is a table for what macros the current Vertica adapter supports for dbt. This is constantly improving and changing as both dbt adds new functionality, as well as the dbt-vertica driver improvies. This list is based upon dbt 1.0.3, with the list found under https://github.com/dbt-labs/dbt-core/tree/main/core/dbt/include/global_project/macros. | ||
|
||
## dbt Macros - adapters | ||
|
||
| dbt Macros - adapters | Function | Implemented | | ||
| ------------------------- | ----------------------------------- | ----------- | | ||
| adapters/columns.sql | get_columns_in_relation() | Yes | | ||
| adapters/columns.sql | sql_convert_columns_in_relation() | No | | ||
| adapters/columns.sql | get_columns_in_query() | Yes | | ||
| adapters/columns.sql | alter_column_type() | No | | ||
| adapters/columns.sql | alter_relation_add_remove_columns() | No | | ||
| adapters/freshness.sql | collect_freshness() | No | | ||
| adapters/freshness.sql | current_timestamp() | Yes | | ||
| adapters/indexes.sql | create_indexes() | Yes | | ||
| adapters/indexes.sql | get_create_index_sql() | No | | ||
| adapters/metadata.sql | get_catalog() | Yes | | ||
| adapters/metadata.sql | information_schema_name() | Yes | | ||
| adapters/metadata.sql | list_schemas() | Yes | | ||
| adapters/metadata.sql | list_relations_without_caching() | Yes | | ||
| adapters/persist_docs.sql | alter_column_comment() | No | | ||
| adapters/persist_docs.sql | alter_relation_comment() | No | | ||
| adapters/persist_docs.sql | persist_docs() | Yes | | ||
| adapters/relation.sql | drop_relation() | Yes | | ||
| adapters/relation.sql | drop_relation_if_exists() | Yes | | ||
| adapters/relation.sql | get_or_create_relation() | No | | ||
| adapters/relation.sql | load_relation() | No | | ||
| adapters/relation.sql | make_temp_relation() | Yes | | ||
| adapters/relation.sql | rename_relation() | Yes | | ||
| adapters/relation.sql | truncate_relation() | Yes | | ||
| adapters/schema.sql | create_schema() | Yes | | ||
| adapters/schema.sql | drop_schema() | Yes | | ||
|
||
## dbt Macros - materializations | ||
| dbt Macros - materializations | Function | Implemented | | ||
| -------------------------------------------------------- | -------------------------------- | ----------- | | ||
| materializations/models/incremental/merge.sql | get_merge_sql() | Yes | | ||
| materializations/models/incremental/merge.sql | get_delete_insert_merge_sql() | Yes | | ||
| materializations/models/incremental/merge.sql | get_insert_overwrite_merge_sql() | No | | ||
| materializations/models/table/create_table_as.sql | create_table_as() | Yes | | ||
| materializations/models/view/create_or_replace_view.sql | create_or_replace_view() | Yes | | ||
| materializations/models/view/create_view_as.sql | create_view_as() | Yes | | ||
| materializations/models/view/create_view_as.sql | get_create_view_as_sql() | Yes | | ||
| materializations/seeds/helpers.sql | create_csv_table() | Yes | | ||
| materializations/seeds/helpers.sql | reset_csv_table() | Yes | | ||
| materializations/seeds/helpers.sql | get_binding_char() | Yes | | ||
| materializations/seeds/helpers.sql | get_seed_column_quoted_csv() | Yes | | ||
| materializations/seeds/helpers.sql | load_csv_rows() | Yes | | ||
| materializations/snapshots/helper.sql | build_snapshot_table() | Yes | | ||
| materializations/snapshots/helper.sql | create_columns() | Yes | | ||
| materializations/snapshots/helper.sql | post_snapshot() | Yes | | ||
| materializations/snapshots/helper.sql | snapshot_staging_table() | Yes | | ||
| materializations/snapshots/snapshot_merge.sql | snapshot_merge_sql() | Yes | | ||
| materializations/snapshots/strategies.sql | snapshot_get_time() | Yes | | ||
| materializations/snapshots/strategies.sql | snapshot_hash_arguments() | Yes | | ||
| materializations/snapshots/strategies.sql | snapshot_string_as_time() | Yes | | ||
| materializations/configs.sql | set_sql_header() | Yes | | ||
| materializations/configs.sql | should_full_refresh() | Yes | | ||
| materializations/configs.sql | should_store_failures() | Yes | | ||
| materializations/hooks.sql | run_hooks() | Yes | | ||
| materializations/hooks.sql | make_hook_config() | Yes | | ||
| materializations/hooks.sql | before_begin() | Yes | | ||
| materializations/hooks.sql | in_transaction() | Yes | | ||
| materializations/hooks.sql | after_commit() | Yes | |
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,59 @@ | ||
{% macro vertica__get_columns_in_relation(relation) -%} | ||
{% call statement('get_columns_in_relation', fetch_result=True) %} | ||
select | ||
column_name | ||
, data_type | ||
, character_maximum_length | ||
, numeric_precision | ||
, numeric_scale | ||
from ( | ||
select | ||
column_name | ||
, data_type | ||
, character_maximum_length | ||
, numeric_precision | ||
, numeric_scale | ||
, ordinal_position | ||
from v_catalog.columns | ||
where table_schema = '{{ relation.schema }}' | ||
and table_name = '{{ relation.identifier }}' | ||
union all | ||
select | ||
column_name | ||
, data_type | ||
, character_maximum_length | ||
, numeric_precision | ||
, numeric_scale | ||
, ordinal_position | ||
from v_catalog.view_columns | ||
where table_schema = '{{ relation.schema }}' | ||
and table_name = '{{ relation.identifier }}' | ||
) t | ||
order by ordinal_position | ||
{% endcall %} | ||
{% set table = load_result('get_columns_in_relation').table %} | ||
{{ return(sql_convert_columns_in_relation(table)) }} | ||
{% endmacro %} | ||
|
||
|
||
{% macro vertica__sql_convert_columns_in_relation(table) -%} | ||
{{ exceptions.raise_not_implemented( | ||
'sql_convert_columns_in_relation macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} | ||
|
||
|
||
{% macro vertica__alter_column_type(relation, column_name, new_column_type) -%} | ||
{{ exceptions.raise_not_implemented( | ||
'alter_column_type macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} | ||
|
||
|
||
{% macro vertica__alter_relation_add_remove_columns(relation, column_name, new_column_type) -%} | ||
{{ exceptions.raise_not_implemented( | ||
'alter_relation_add_remove_columns macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} | ||
|
||
|
||
{# | ||
No need to implement get_columns_in_query(). Syntax supported by default. | ||
#} |
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,9 @@ | ||
{% macro vertica__current_timestamp() -%} | ||
current_timestamp | ||
{%- endmacro %} | ||
|
||
|
||
{% macro vertica__collect_freshness() -%} | ||
{{ exceptions.raise_not_implemented( | ||
'collect_freshness macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} |
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,9 @@ | ||
{% macro vertica__get_create_index_sql(relation, index_dict) -%} | ||
{{ exceptions.raise_not_implemented( | ||
'get_create_index_sql macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} | ||
|
||
|
||
{# | ||
No need to implement create_indexes(). Syntax supported by default. | ||
#} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% macro vertica__alter_column_comment(relation, column_dict) -%} | ||
{{ exceptions.raise_not_implemented( | ||
'alter_column_comment macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} | ||
|
||
|
||
{% macro vertica__alter_relation_comment(relation, relation_comment) -%} | ||
{{ exceptions.raise_not_implemented( | ||
'alter_relation_comment macro not implemented for adapter '+adapter.type()) }} | ||
{%- endmacro %} | ||
|
||
|
||
{# | ||
No need to implement persist_docs(). Syntax supported by default. | ||
#} |
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.
improvies -> improves
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.
Thanks. Fixed the typo.
It definitely makes life easier for developers. I saw they were refactoring the whole testing suite, removing a lot of the "magic" from what's going on behind the scenes.