-
Notifications
You must be signed in to change notification settings - Fork 35
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
Enable & pass dbt-adapter-tests #16
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6fdd77f
needed for integration testing
dataders d4bcd6a
drop_relation never worked?
dataders e867ba7
align arguments with dbt-core
dataders 5391893
TSQL does not support DROP SCHEMA ... cascade
dataders f69e2d0
align arguments with dbt-core
dataders 77b7524
USE is not supported on Synapse
dataders 7ca014d
align args with dbt-core
dataders 9861eff
limit is not supported in T-SQL
dataders 649024e
typo
dataders ae2f008
add custom test methods from Base Adapter
dataders 0675f83
document T-SQL support discrepancies
dataders 96d7760
required for customized test methods
dataders 1a9902c
typo
dataders 0e81bc3
`+` is T-SQL's string concatenation operator
dataders 8dceff3
3.6 support now in master
dataders 52326c0
accurate testing information
dataders a7fdd70
ephemeral and incremental tests are working??
dataders 0314354
dropping conda in support of Docker and pip
dataders a8225d2
changelog
dataders 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
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 |
---|---|---|
|
@@ -2,6 +2,15 @@ | |
information_schema | ||
{%- endmacro %} | ||
|
||
{% macro sqlserver__get_columns_in_query(select_sql) %} | ||
{% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%} | ||
select TOP 0 * from ( | ||
{{ select_sql }} | ||
) as __dbt_sbq | ||
{% endcall %} | ||
{{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }} | ||
{% endmacro %} | ||
|
||
{% macro sqlserver__list_relations_without_caching(schema_relation) %} | ||
{% call statement('list_relations_without_caching', fetch_result=True) -%} | ||
select | ||
|
@@ -36,9 +45,24 @@ | |
{% endcall %} | ||
{% endmacro %} | ||
|
||
{% macro sqlserver__drop_schema(database_name, schema_name) -%} | ||
{% macro sqlserver__drop_schema(relation) -%} | ||
{%- set tables_in_schema_query %} | ||
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES | ||
WHERE TABLE_SCHEMA = '{{ relation.schema }}' | ||
{% endset %} | ||
{% set tables_to_drop = run_query(tables_in_schema_query).columns[0].values() %} | ||
{% for table in tables_to_drop %} | ||
{%- set schema_relation = adapter.get_relation(database=relation.database, | ||
schema=relation.schema, | ||
identifier=table) -%} | ||
{% do drop_relation(schema_relation) %} | ||
{%- endfor %} | ||
|
||
{% call statement('drop_schema') -%} | ||
drop schema if exists {{ relation.without_identifier().schema }} | ||
IF EXISTS (SELECT * FROM sys.schemas WHERE name = '{{ relation.schema }}') | ||
BEGIN | ||
EXEC('DROP SCHEMA {{ relation.schema }}') | ||
END | ||
Comment on lines
+48
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mikaelene here is the change we made that @jtcohen6 mentioned here dbt-msft/dbt-sqlserver#54 (comment). In our adapters we never use |
||
{% endcall %} | ||
{% endmacro %} | ||
|
||
|
@@ -71,9 +95,8 @@ | |
end | ||
{% endmacro %} | ||
|
||
{% macro sqlserver__check_schema_exists(database, schema) -%} | ||
{% macro sqlserver__check_schema_exists(information_schema, schema) -%} | ||
{% call statement('check_schema_exists', fetch_result=True, auto_begin=False) -%} | ||
--USE {{ database_name }} | ||
SELECT count(*) as schema_exist FROM sys.schemas WHERE name = '{{ schema }}' | ||
{%- endcall %} | ||
{{ return(load_result('check_schema_exists').table) }} | ||
|
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
dbt-sqlserver==0.15.2 | ||
dbt==0.15.3 | ||
dbt-core~=0.18.0 | ||
pyodbc>=4.0.27 | ||
azure-identity>=1.4.0 | ||
black~=20.8b1 | ||
git+https://github.com/fishtown-analytics/dbt-adapter-tests.git | ||
. |
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,20 @@ | ||
target: | ||
type: sqlserver | ||
driver: "ODBC Driver 17 for SQL Server" | ||
schema: "dbt_test_{{ var('_dbt_random_suffix') }}" | ||
host: host | ||
database: database | ||
username: username | ||
password: password | ||
port: port | ||
threads: 8 | ||
sequences: | ||
test_dbt_empty: empty | ||
test_dbt_base: base | ||
test_dbt_ephemeral: ephemeral | ||
test_dbt_incremental: incremental | ||
test_dbt_snapshot_strategy_timestamp: snapshot_strategy_timestamp | ||
test_dbt_snapshot_strategy_check_cols: snapshot_strategy_check_cols | ||
test_dbt_data_test: data_test | ||
test_dbt_schema_test: schema_test | ||
# test_dbt_ephemeral_data_tests: data_test_ephemeral_models |
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.
@mikaelene, this is one macro we had to overwrite. perhaps this is the error you were seeing?