Skip to content

Commit 2ae8352

Browse files
author
Pradeep Srikakolapu
committed
Cloning dbt-sqlsever code for Trident DW adapter
1 parent 414f7c6 commit 2ae8352

77 files changed

Lines changed: 3715 additions & 23 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: pip
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
- package-ecosystem: github-actions
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
- package-ecosystem: docker
13+
directory: "/"
14+
schedule:
15+
interval: daily
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
name: Integration tests on Azure
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- master
7+
- v*
8+
- azure-testing
9+
pull_request_target:
10+
types: [labeled]
11+
12+
jobs:
13+
integration-tests-azure:
14+
name: Integration tests on Azure
15+
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.ref_name == 'master' || github.ref_name == 'azure-testing'
16+
strategy:
17+
matrix:
18+
python_version: ["3.7", "3.8", "3.9", "3.10"]
19+
profile: ["ci_azure_cli", "ci_azure_auto", "ci_azure_environment", "ci_azure_basic"]
20+
msodbc_version: ["17", "18"]
21+
max-parallel: 1
22+
runs-on: ubuntu-latest
23+
container:
24+
image: ghcr.io/${{ github.repository }}:CI-${{ matrix.python_version }}-msodbc${{ matrix.msodbc_version }}
25+
steps:
26+
- name: AZ CLI login
27+
run: az login --service-principal --username="${AZURE_CLIENT_ID}" --password="${AZURE_CLIENT_SECRET}" --tenant="${AZURE_TENANT_ID}"
28+
env:
29+
AZURE_CLIENT_ID: ${{ secrets.DBT_AZURE_SP_NAME }}
30+
AZURE_CLIENT_SECRET: ${{ secrets.DBT_AZURE_SP_SECRET }}
31+
AZURE_TENANT_ID: ${{ secrets.DBT_AZURE_TENANT }}
32+
33+
- uses: actions/checkout@v3
34+
35+
- name: Install dependencies
36+
run: pip install -r dev_requirements.txt
37+
38+
- name: Wake up server
39+
env:
40+
DBT_AZURESQL_SERVER: ${{ secrets.DBT_AZURESQL_SERVER }}
41+
DBT_AZURESQL_DB: ${{ secrets.DBT_AZURESQL_DB }}
42+
DBT_AZURESQL_UID: ${{ secrets.DBT_AZURESQL_UID }}
43+
DBT_AZURESQL_PWD: ${{ secrets.DBT_AZURESQL_PWD }}
44+
MSODBC_VERSION: ${{ matrix.msodbc_version }}
45+
run: python devops/scripts/wakeup_azure.py
46+
47+
- name: Configure test users
48+
run: sqlcmd -b -I -i devops/scripts/init.sql
49+
env:
50+
DBT_TEST_USER_1: DBT_TEST_USER_1
51+
DBT_TEST_USER_2: DBT_TEST_USER_2
52+
DBT_TEST_USER_3: DBT_TEST_USER_3
53+
SQLCMDUSER: ${{ secrets.DBT_AZURESQL_UID }}
54+
SQLCMDPASSWORD: ${{ secrets.DBT_AZURESQL_PWD }}
55+
SQLCMDSERVER: ${{ secrets.DBT_AZURESQL_SERVER }}
56+
SQLCMDDBNAME: ${{ secrets.DBT_AZURESQL_DB }}
57+
58+
- name: Run functional tests
59+
env:
60+
DBT_AZURESQL_SERVER: ${{ secrets.DBT_AZURESQL_SERVER }}
61+
DBT_AZURESQL_DB: ${{ secrets.DBT_AZURESQL_DB }}
62+
DBT_AZURESQL_UID: ${{ secrets.DBT_AZURESQL_UID }}
63+
DBT_AZURESQL_PWD: ${{ secrets.DBT_AZURESQL_PWD }}
64+
AZURE_CLIENT_ID: ${{ secrets.DBT_AZURE_SP_NAME }}
65+
AZURE_CLIENT_SECRET: ${{ secrets.DBT_AZURE_SP_SECRET }}
66+
AZURE_TENANT_ID: ${{ secrets.DBT_AZURE_TENANT }}
67+
DBT_TEST_USER_1: DBT_TEST_USER_1
68+
DBT_TEST_USER_2: DBT_TEST_USER_2
69+
DBT_TEST_USER_3: DBT_TEST_USER_3
70+
DBT_TEST_AAD_PRINCIPAL_1: ${{ secrets.DBT_TEST_AAD_PRINCIPAL_1 }}
71+
DBT_TEST_AAD_PRINCIPAL_2: ${{ secrets.DBT_TEST_AAD_PRINCIPAL_2 }}
72+
SQLSERVER_TEST_DRIVER: 'ODBC Driver ${{ matrix.msodbc_version }} for SQL Server'
73+
run: pytest -ra -v tests/functional --profile "${{ matrix.profile }}"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Integration tests on SQL Server
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- master
7+
- v*
8+
pull_request:
9+
branches:
10+
- master
11+
- v*
12+
13+
jobs:
14+
integration-tests-sql-server:
15+
name: Integration tests on SQL Server
16+
strategy:
17+
matrix:
18+
python_version: ["3.7", "3.8", "3.9", "3.10"]
19+
msodbc_version: ["17", "18"]
20+
sqlserver_version: ["2017", "2019", "2022"]
21+
runs-on: ubuntu-latest
22+
container:
23+
image: ghcr.io/${{ github.repository }}:CI-${{ matrix.python_version }}-msodbc${{ matrix.msodbc_version }}
24+
services:
25+
sqlserver:
26+
image: ghcr.io/${{ github.repository }}:server-${{ matrix.sqlserver_version }}
27+
env:
28+
ACCEPT_EULA: 'Y'
29+
SA_PASSWORD: 5atyaNadella
30+
DBT_TEST_USER_1: DBT_TEST_USER_1
31+
DBT_TEST_USER_2: DBT_TEST_USER_2
32+
DBT_TEST_USER_3: DBT_TEST_USER_3
33+
steps:
34+
- uses: actions/checkout@v3
35+
36+
- name: Install dependencies
37+
run: pip install -r dev_requirements.txt
38+
39+
- name: Run functional tests
40+
run: pytest -ra -v tests/functional --profile "ci_sql_server"
41+
env:
42+
DBT_TEST_USER_1: DBT_TEST_USER_1
43+
DBT_TEST_USER_2: DBT_TEST_USER_2
44+
DBT_TEST_USER_3: DBT_TEST_USER_3
45+
SQLSERVER_TEST_DRIVER: 'ODBC Driver ${{ matrix.msodbc_version }} for SQL Server'
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Publish Docker images for CI/CD
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
paths:
6+
- 'devops/**'
7+
- '.github/workflows/publish-docker.yml'
8+
branches:
9+
- 'master'
10+
11+
jobs:
12+
publish-docker-client:
13+
strategy:
14+
matrix:
15+
python_version: ["3.7", "3.8", "3.9", "3.10"]
16+
docker_target: ["msodbc17", "msodbc18"]
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Log in to the Container registry
26+
uses: docker/[email protected]
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build and push Docker image
33+
uses: docker/[email protected]
34+
with:
35+
context: devops
36+
build-args: PYTHON_VERSION=${{ matrix.python_version }}
37+
file: devops/CI.Dockerfile
38+
push: true
39+
platforms: linux/amd64
40+
target: ${{ matrix.docker_target }}
41+
tags: ghcr.io/${{ github.repository }}:CI-${{ matrix.python_version }}-${{ matrix.docker_target }}
42+
43+
publish-docker-server:
44+
strategy:
45+
matrix:
46+
mssql_version: ["2017", "2019", "2022"]
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
packages: write
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v3
54+
55+
- name: Log in to the Container registry
56+
uses: docker/[email protected]
57+
with:
58+
registry: ghcr.io
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Build and push Docker image
63+
uses: docker/[email protected]
64+
with:
65+
context: devops
66+
build-args: MSSQL_VERSION=${{ matrix.mssql_version }}
67+
file: devops/server.Dockerfile
68+
push: true
69+
platforms: linux/amd64
70+
tags: ghcr.io/${{ github.repository }}:server-${{ matrix.mssql_version }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Release new version
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
jobs:
10+
release-version:
11+
name: Release new version
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.9'
19+
20+
- name: Install dependencies
21+
run: pip install -r dev_requirements.txt
22+
23+
- name: Verify version match
24+
run: python setup.py verify
25+
26+
- name: Initialize .pypirc
27+
run: |
28+
echo -e "[pypi]" >> ~/.pypirc
29+
echo -e "username = __token__" >> ~/.pypirc
30+
echo -e "password = ${{ secrets.PYPI_DBT_SQLSERVER }}" >> ~/.pypirc
31+
32+
- name: Build and publish package
33+
run: |
34+
python setup.py sdist bdist_wheel
35+
twine upload dist/*

.github/workflows/unit-tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Unit tests
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- master
7+
- v*
8+
pull_request:
9+
branches:
10+
- master
11+
- v*
12+
13+
jobs:
14+
unit-tests:
15+
name: Unit tests
16+
strategy:
17+
matrix:
18+
python_version: ["3.7", "3.8", "3.9", "3.10"]
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: read
23+
container:
24+
image: ghcr.io/${{ github.repository }}:CI-${{ matrix.python_version }}-msodbc18
25+
credentials:
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.github_token }}
28+
steps:
29+
30+
- uses: actions/checkout@v3
31+
32+
- name: Install dependencies
33+
run: pip install -r dev_requirements.txt
34+
35+
- name: Run unit tests
36+
run: pytest tests/unit

.gitignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
# C extensions
6+
*.so
7+
8+
# Distribution / packaging
9+
.Python
10+
env/
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
*.egg-info/
23+
/*.egg-info
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*.cover
46+
*.log.legacy
47+
48+
# Translations
49+
*.mo
50+
*.pot
51+
52+
# Django stuff:
53+
*.log
54+
55+
# Sphinx documentation
56+
docs/_build/
57+
58+
# PyBuilder
59+
target/
60+
61+
# DotEnv configuration
62+
.env
63+
64+
# Database
65+
*.db
66+
*.rdb
67+
68+
# Pycharm
69+
.idea
70+
71+
# Spyder
72+
.spyproject/
73+
74+
# Jupyter NB Checkpoints
75+
.ipynb_checkpoints/
76+
77+
# exclude data from source control by default
78+
/data/
79+
80+
# Mac OS-specific storage files
81+
.DS_Store
82+
83+
# vim
84+
*.swp
85+
*.swo
86+
87+
# Mypy cache
88+
.mypy_cache/
89+
90+
# Environments
91+
*.env
92+
.venv
93+
env/
94+
venv/
95+
ENV/
96+
env.bak/
97+
venv.bak/

0 commit comments

Comments
 (0)