diff --git a/.circleci/config.yml b/.circleci/config.yml index 672f16d4..fbf3b0ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ orbs: python: circleci/python@1.1.0 jobs: - integration-sqlserver: + integration-sqlserver: &sqlserver docker: - image: dataders/pyodbc:1.4 - image: mcr.microsoft.com/mssql/server:2019-latest @@ -26,6 +26,46 @@ jobs: - run: name: Test adapter on SQL Server against dbt-adapter-tests command: tox -e integration-sqlserver + connection-sqlserver: + <<: *sqlserver + steps: + - checkout + - python/install-packages: + pkg-manager: pip + - run: + name: wait for SQL Server container to set up + command: sleep 30 + - run: + name: prep for connecting + command: | + mkdir -p ~/.dbt + cd test/integration + cp sample.profiles.yml ~/.dbt/profiles.yml + + - run: + name: cnxn -- SQL Server - local sql cred + command: | + cd test/integration + dbt compile --target sqlserver_local_userpass + - run: + name: cnxn -- SQL Server - local sql cred encrypt + command: | + cd test/integration + dbt compile --target sqlserver_local_encrypt + - run: + name: cnxn -- Azure SQL - SQL cred + command: | + cd test/integration + dbt compile --target azuresql_sqlcred + + # TODO drop support for this method in favor of + # https://github.com/dbt-msft/dbt-sqlserver/pull/71 + # - run: + # name: cnxn -- Azure SQL - AAD Password + # command: | + # cd test/integration + # dbt compile --target azuresql_aad + integration-azuresql: docker: - image: dataders/pyodbc:1.4 @@ -41,6 +81,9 @@ jobs: workflows: main: jobs: + - connection-sqlserver: + context: + - DBT_SYNAPSE_PROFILE - integration-sqlserver - integration-azuresql: context: diff --git a/requirements.txt b/requirements.txt index 80015832..3d44b029 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ black~=20.8b1 pytest-dbt-adapter~=0.3.0 tox==3.2.0 flake8>=3.5.0 -certifi==2020.6.20 \ No newline at end of file +certifi==2020.6.20 +. \ No newline at end of file diff --git a/test/integration/dbt_project.yml b/test/integration/dbt_project.yml new file mode 100644 index 00000000..f02f89c5 --- /dev/null +++ b/test/integration/dbt_project.yml @@ -0,0 +1,6 @@ + +name: 'sqlserver_integration_tests' +version: '1.0' +config-version: 2 + +profile: 'integration_tests' \ No newline at end of file diff --git a/test/integration/models/test.sql b/test/integration/models/test.sql new file mode 100644 index 00000000..90664768 --- /dev/null +++ b/test/integration/models/test.sql @@ -0,0 +1,3 @@ +{# inane comment #} +{% set col_name = 'foo' %} +SELECT 1 as {{ col_name }} \ No newline at end of file diff --git a/test/integration/sample.profiles.yml b/test/integration/sample.profiles.yml new file mode 100644 index 00000000..a9f69842 --- /dev/null +++ b/test/integration/sample.profiles.yml @@ -0,0 +1,42 @@ +# HEY! This file is used in the tsql_utils integrations tests with CircleCI. +# You should __NEVER__ check credentials into version control. Thanks for reading :) + +config: + send_anonymous_usage_stats: False + use_colors: True + +defaults: + sqlserver: &sqlserver + type: sqlserver + driver: "ODBC Driver 17 for SQL Server" + schema: "dbt_cnxn_test" + port: 1433 + threads: 8 + +integration_tests: + target: sqlserver_local_userpass + outputs: + sqlserver_local_userpass: &sqlserver-local + <<: *sqlserver + host: localhost + database: msdb + username: SA + password: 5atyaNadella + sqlserver_local_encrypt: + <<: *sqlserver-local + encrypt: yes + trust_cert: yes + azuresql_sqlcred: &azuresql + <<: *sqlserver + host: "{{ env_var('DBT_AZURESQL_SERVER') }}" + database: "{{ env_var('DBT_AZURESQL_DB') }}" + username: "{{ env_var('DBT_AZURESQL_UID') }}" + password: "{{ env_var('DBT_AZURESQL_PWD') }}" + encrypt: yes + trust_cert: yes + azuresql_aad: + <<: *azuresql + authentication: ActiveDirectoryPassword + username: "{{ env_var('DBT_AZURESQL_AAD_USER') }}" + password: "{{ env_var('DBT_AZURESQL_AAD_PASS') }}" +