Skip to content
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

Release branch 1.6.5 #117

Merged
merged 70 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
3b9e3c4
IDE-24142: Add --no-inject-ephemeral-ctes flag for compile command
Oct 13, 2023
5a285cd
created a branch for 1.6.5 release
Oct 16, 2023
010a518
Add macros/utils folder to the package (#112)
septimit Oct 16, 2023
f99d807
Update cd-release-testpypi.yml
tallamohan Oct 16, 2023
7c1e914
Update test_ephemeral_compilation.py
Oct 16, 2023
a64baac
Update cd-release-testpypi.yml
Oct 16, 2023
2c2ca00
Update cd-release-testpypi.yml
Oct 16, 2023
6b5a2bb
Update cd-release-testpypi.yml
Oct 16, 2023
e6fb554
Merge pull request #114 from Teradata/MT255026_IDE-24142_1.6.x
tallamohan Oct 17, 2023
5040d3a
Update snapshot code to dbt-core 1.6.2 (#115)
septimit Nov 1, 2023
af061fd
Update ci-integration-tests.yml increasing req time to 25
VarunSharma15 Nov 1, 2023
fd6edfa
Update ci-integration-tests.yml
VarunSharma15 Nov 1, 2023
802abc3
Update ci-integration-tests.yml
VarunSharma15 Nov 1, 2023
88e1206
Update ci-integration-tests.yml
VarunSharma15 Nov 1, 2023
05cf7d7
undoing the maxrequired time to 20
VarunSharma15 Nov 2, 2023
ccac4b0
Updated TTU and VE url
VarunSharma15 Nov 2, 2023
ea3b289
Update verifyVantageIsRunning.sh
VarunSharma15 Nov 3, 2023
271f168
Update verifyVantageIsRunning.sh
VarunSharma15 Nov 3, 2023
4260f74
Update ci-integration-tests.yml
VarunSharma15 Nov 3, 2023
3628a98
Update verifyVantageIsRunning.sh
tallamohan Nov 3, 2023
230c8a2
Update ci-integration-tests.yml
VarunSharma15 Nov 3, 2023
4f65efd
Update ci-integration-tests.yml
tallamohan Nov 3, 2023
565c8cd
Update ci-integration-tests.yml
tallamohan Nov 3, 2023
eab1bf1
Update ci-integration-tests.yml
satish-chinthanippu Nov 3, 2023
303945c
Update ci-integration-tests.yml
satish-chinthanippu Nov 3, 2023
8e465a2
Update ci-integration-tests.yml
satish-chinthanippu Nov 3, 2023
7ae82af
Update ci-integration-tests.yml
satish-chinthanippu Nov 3, 2023
8d1461f
Update ci-integration-tests.yml
VarunSharma15 Nov 5, 2023
0f13f36
Update ci-integration-tests.yml
VarunSharma15 Nov 5, 2023
ad8f47f
Update ci-integration-tests.yml
VarunSharma15 Nov 5, 2023
4c02528
Update ci-integration-tests.yml
VarunSharma15 Nov 5, 2023
710958f
Update ci-integration-tests.yml
VarunSharma15 Nov 6, 2023
4c0d92e
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
c664680
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
82acc28
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
593eb01
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
c5eb41c
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
07679bb
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
ae1cb34
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
d681f59
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
6efd6a2
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
ef10520
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
70a7a92
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
171b3e3
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
f266d92
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
45ae2a3
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
912c37f
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
246357d
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
0f32ff7
Update ci-integration-tests-new.yml
tallamohan Nov 6, 2023
05f2afa
Update ci-integration-tests-new.yml
VarunSharma15 Nov 6, 2023
af64365
Update ci-integration-tests-new.yml
VarunSharma15 Nov 6, 2023
4a76bc2
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
40733ce
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
5232abe
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
485d2f2
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
d99cb55
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
7afb1d7
Update ci-integration-tests.yml
VarunSharma15 Nov 7, 2023
6c45ae3
Update verifyVantageIsRunning.sh
VarunSharma15 Nov 7, 2023
fd7f5c1
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
6cb919c
added 1.6.7 dependency
Nov 7, 2023
da735cd
Merge branch 'Release_branch_1.6.5' of https://github.com/Teradata/db…
Nov 7, 2023
8d79917
fixing septi's change (#116)
VarunSharma15 Nov 7, 2023
c9d1ba4
skipping current_timestamp tests
VarunSharma15 Nov 7, 2023
5b22d7b
removed the already done python versions and some tests
VarunSharma15 Nov 7, 2023
27ea3a8
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
7213bdf
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
9b99ef4
Update ci-integration-tests-new.yml
VarunSharma15 Nov 7, 2023
4006c64
Update ci-integration-tests-new.yml
tallamohan Nov 7, 2023
5a7fac5
Merge branch 'main' into Release_branch_1.6.5
VarunSharma15 Nov 7, 2023
aa745f2
changelog changes (#118)
VarunSharma15 Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 83 additions & 40 deletions .github/workflows/ci-integration-tests-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,42 @@ on:
jobs:
test:
strategy:
max-parallel: 1
matrix:
python: ['3.8']
python: ['3.10', '3.11']
runs-on: ubuntu-latest
name: Functional test
steps:
# - name: Start Clearscape DBS
# shell: bash
# run: |
# curl -X 'PATCH' \
# 'https://api.clearscape.teradata.com/environments/dbt-teradata-1' \
# -H 'accept: application/json' \
# -H 'Authorization: Bearer 2OKQYw4jhaCO3T7UBLjYmsoTxs73IG9q4Ps3kZT6DpnKBKO2mLYd4k6QkGuwW9db' \
# -H 'Content-Type: application/json' \
# -d '{
# "operation": "start"
# }'

# curl -X 'PATCH' \
# 'https://api.clearscape.teradata.com/environments/dbt-teradata-2' \
# -H 'accept: application/json' \
# -H 'Authorization: Bearer 2OKQYw4jhaCO3T7UBLjYmsoTxs73IG9q4Ps3kZT6DpnKBKO2mLYd4k6QkGuwW9db' \
# -H 'Content-Type: application/json' \
# -d '{
# "operation": "start"
# }'

# curl -X 'PATCH' \
# 'https://api.clearscape.teradata.com/environments/dbt-teradata-3' \
# -H 'accept: application/json' \
# -H 'Authorization: Bearer 2OKQYw4jhaCO3T7UBLjYmsoTxs73IG9q4Ps3kZT6DpnKBKO2mLYd4k6QkGuwW9db' \
# -H 'Content-Type: application/json' \
# -d '{
# "operation": "start"
# }'

- name: Setup Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -45,7 +76,9 @@ jobs:
# cd md5_20080530/md5/src

# # prepare bteq script

# cat << EOF > /tmp/install_md5.bteq

# .SET EXITONDELAY ON MAXREQTIME 20
# .logon $DBT_TERADATA_SERVER_NAME/$DBT_TERADATA_USERNAME,$DBT_TERADATA_PASSWORD
# CREATE DATABASE GLOBAL_FUNCTIONS AS PERMANENT = 60e6, SPOOL = 120e6;
Expand All @@ -61,29 +94,17 @@ jobs:
# DBT_TERADATA_SERVER_NAME: ${{ vars.DBT_TERADATA_SERVER_NAME }}
# DBT_TERADATA_USERNAME: ${{ vars.DBT_TERADATA_USERNAME }}
# DBT_TERADATA_PASSWORD: ${{ vars.DBT_TERADATA_PASSWORD }}


- name: Run pytest tests
run: |
sed -i "s/localhost/$DBT_TERADATA_SERVER_NAME/g" tests/conftest.py
sed -i "s/username='dbc'/username='$DBT_TERADATA_USERNAME'/g" tests/conftest.py
sed -i "s/password='dbc'/password='$DBT_TERADATA_PASSWORD'/g" tests/conftest.py
export DBT_TEST_USER_1=test_grants_user1
export DBT_TEST_USER_2=test_grants_user2
export DBT_TEST_USER_3=test_grants_user3
pytest tests/functional
- name: Run pytest tests with existing database
run: |
export DBT_TEST_USER_1=test_grants_user1
export DBT_TEST_USER_2=test_grants_user2
export DBT_TEST_USER_3=test_grants_user3
cat << EOF > /tmp/pytestdatabase.bteq
.SET EXITONDELAY ON MAXREQTIME 20
.logon $DBT_TERADATA_SERVER_NAME/$DBT_TERADATA_USERNAME,$DBT_TERADATA_PASSWORD
CREATE DATABASE DBT_TEST
AS PERMANENT = 60e6, SPOOL = 120e6;
.logoff
EOF
# strip the random suffix from the pytest config
sed -i'.original' -e "s/_{prefix}//" tests/conftest.py

pytest tests/functional
pytest -v -k "not TestCurrentTimestamp" tests/functional
env:
DBT_TERADATA_SERVER_NAME: ${{ vars.DBT_TERADATA_SERVER_NAME }}
DBT_TERADATA_USERNAME: ${{ vars.DBT_TERADATA_USERNAME }}
Expand All @@ -109,9 +130,9 @@ jobs:
retries: 1
dbt_catalog_test:
type: teradata
host: $DBT_TERADATA_SERVER_NAME
user: $DBT_TERADATA_USERNAME
password: $DBT_TERADATA_PASSWORD
host: $DBT_TERADATA_SERVER_NAME_1
user: $DBT_TERADATA_USERNAME_1
password: $DBT_TERADATA_PASSWORD_1
logmech: TD2
schema: dbt_catalog_test
tmode: ANSI
Expand All @@ -126,37 +147,59 @@ jobs:
DBT_TERADATA_SERVER_NAME: ${{ vars.DBT_TERADATA_SERVER_NAME }}
DBT_TERADATA_USERNAME: ${{ vars.DBT_TERADATA_USERNAME }}
DBT_TERADATA_PASSWORD: ${{ vars.DBT_TERADATA_PASSWORD }}
DBT_TERADATA_SERVER_NAME_1: ${{ vars.DBT_TERADATA_SERVER_NAME_1 }}
DBT_TERADATA_USERNAME_1: ${{ vars.DBT_TERADATA_USERNAME_1 }}
DBT_TERADATA_PASSWORD_1: ${{ vars.DBT_TERADATA_PASSWORD_1 }}

- name: Run catalog tests
run: |
# set DisableQVCI to false - this will give us data type info for views in DBC.ColumnsJQV
sshpass -p root ssh -o StrictHostKeyChecking=no -p 4422 root@localhost "dbscontrol << EOF
M internal 551=false
W
EOF

tpareset -y Enable QVCI
"

$GITHUB_WORKSPACE/.github/workflows/scripts/verifyVantageIsRunning.sh

cd $GITHUB_WORKSPACE/test/catalog/with_qvci
./run.sh
cd $GITHUB_WORKSPACE/test/catalog/without_qvci
./run.sh

- name: Run nopi tests
run: |
sshpass -p root ssh -o StrictHostKeyChecking=no -p 4422 root@localhost "dbscontrol << EOF
M general 53=N
W
EOF
sed -i "s/hostname=dbt.*/hostname='$DBT_TERADATA_SERVER_NAME_2'/g" tests/conftest.py
sed -i "s/username=demo.*/username='$DBT_TERADATA_USERNAME_2'/g" tests/conftest.py
sed -i "s/password=dbt.*/password='$DBT_TERADATA_PASSWORD_2'/g" tests/conftest.py
pytest tests/functional/adapter/test_nopi.py
env:
DBT_TERADATA_SERVER_NAME_2: ${{ vars.DBT_TERADATA_SERVER_NAME_2 }}
DBT_TERADATA_USERNAME_2: ${{ vars.DBT_TERADATA_USERNAME_2 }}
DBT_TERADATA_PASSWORD_2: ${{ vars.DBT_TERADATA_PASSWORD_2 }}

tpareset -y Disable PrimaryIndexDefault
"
# - name: Stop Clearscape DBS
# if: always()
# shell: bash
# run: |
# curl -X 'PATCH' \
# 'https://api.clearscape.teradata.com/environments/dbt-teradata-1' \
# -H 'accept: application/json' \
# -H 'Authorization: Bearer 2OKQYw4jhaCO3T7UBLjYmsoTxs73IG9q4Ps3kZT6DpnKBKO2mLYd4k6QkGuwW9db' \
# -H 'Content-Type: application/json' \
# -d '{
# "operation": "stop"
# }'

$GITHUB_WORKSPACE/.github/workflows/scripts/verifyVantageIsRunning.sh
# curl -X 'PATCH' \
# 'https://api.clearscape.teradata.com/environments/dbt-teradata-2' \
# -H 'accept: application/json' \
# -H 'Authorization: Bearer 2OKQYw4jhaCO3T7UBLjYmsoTxs73IG9q4Ps3kZT6DpnKBKO2mLYd4k6QkGuwW9db' \
# -H 'Content-Type: application/json' \
# -d '{
# "operation": "stop"
# }'

pytest tests/functional/adapter/test_nopi.py
# curl -X 'PATCH' \
# 'https://api.clearscape.teradata.com/environments/dbt-teradata-3' \
# -H 'accept: application/json' \
# -H 'Authorization: Bearer 2OKQYw4jhaCO3T7UBLjYmsoTxs73IG9q4Ps3kZT6DpnKBKO2mLYd4k6QkGuwW9db' \
# -H 'Content-Type: application/json' \
# -d '{
# "operation": "stop"
# }'

- uses: actions/upload-artifact@v2
if: ${{ failure() || cancelled() }}
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
strategy:
matrix:
python: ['3.8', '3.9','3.10', '3.11']
python: ['3.8', '3.9', '3.10', '3.11']
runs-on: macos-12
name: Functional test
steps:
Expand All @@ -28,7 +28,7 @@ jobs:
echo "my IP address is: " $(ipconfig getifaddr en0)
mkdir /tmp/downloads
cd /tmp/downloads
curl -L "https://d289lrf5tw1zls.cloudfront.net/database/teradata-express/VantageExpress17.20_Sles12_20220819081111.7z?Expires=1704067200&Key-Pair-Id=APKAJ3SWQUPWKYVMO2WQ&Signature=$VE_URL_SIGNATURE" \
curl -L "https://d289lrf5tw1zls.cloudfront.net/database/teradata-express/VantageExpress17.20_Sles12_20220819081111.7z?Expires=1735689600&Signature=$VE_URL_SIGNATURE&Key-Pair-Id=APKAJ3SWQUPWKYVMO2WQ" \
--compressed -o ve.7z
env:
VE_URL_SIGNATURE: ${{ secrets.VE_URL_SIGNATURE }}
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Install TTU
shell: bash
run: |
curl -L "https://d289lrf5tw1zls.cloudfront.net/tools/ttu/TeradataToolsAndUtilitiesBase__macosx_x86_64.17.20.08.00.tar.gz?Expires=1704067200&Key-Pair-Id=APKAJ3SWQUPWKYVMO2WQ&Signature=$TTU_URL_SIGNATURE" \
curl -L "https://d289lrf5tw1zls.cloudfront.net/tools/ttu/TeradataToolsAndUtilitiesBase__macosx_x86_64.17.20.08.00.tar.gz?Expires=1735689600&Signature=$TTU_URL_SIGNATURE&Key-Pair-Id=APKAJ3SWQUPWKYVMO2WQ" \
--compressed -o ttu.tar.gz
tar -xzf ttu.tar.gz

Expand Down
127 changes: 127 additions & 0 deletions dbt/include/teradata/macros/materializations/snapshot/helpers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{% macro teradata__snapshot_staging_table(strategy, source_sql, target_relation) -%}

with snapshot_query as (

{{ source_sql }}

),

snapshotted_data as (

select snapshot.*,
{{ strategy.unique_key }} as dbt_unique_key

from {{ target_relation }} as snapshot
where dbt_valid_to is null

),

insertions_source_data as (

select
snapshot_query.*,
{{ strategy.unique_key }} as dbt_unique_key,
{{ strategy.updated_at }} as dbt_updated_at,
{{ strategy.updated_at }} as dbt_valid_from,
nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,
{{ strategy.scd_id }} as dbt_scd_id

from snapshot_query
),

updates_source_data as (

select
snapshot_query.*,
{{ strategy.unique_key }} as dbt_unique_key,
{{ strategy.updated_at }} as dbt_updated_at,
{{ strategy.updated_at }} as dbt_valid_from,
{{ strategy.updated_at }} as dbt_valid_to

from snapshot_query
),

{%- if strategy.invalidate_hard_deletes %}

deletes_source_data as (

select
snapshot_query.*,
{{ strategy.unique_key }} as dbt_unique_key
from snapshot_query
),
{% endif %}

insertions as (

select
'insert' as dbt_change_type,
source_data.*

from insertions_source_data as source_data
left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key
where snapshotted_data.dbt_unique_key is null
or (
snapshotted_data.dbt_unique_key is not null
and (
{{ strategy.row_changed }}
)
)

),

updates as (

select
'update' as dbt_change_type,
source_data.*,
snapshotted_data.dbt_scd_id

from updates_source_data as source_data
join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key
where (
{{ strategy.row_changed }}
)
)

{%- if strategy.invalidate_hard_deletes -%}
,

deletes as (

select
'delete' as dbt_change_type,
source_data.*,
{{ snapshot_get_time() }} as dbt_valid_from,
{{ snapshot_get_time() }} as dbt_updated_at,
{{ snapshot_get_time() }} as dbt_valid_to,
snapshotted_data.dbt_scd_id

from snapshotted_data
left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key
where source_data.dbt_unique_key is null
)
{%- endif %}

select * from insertions
union all
select * from updates
{%- if strategy.invalidate_hard_deletes %}
union all
select * from deletes
{%- endif %}

{%- endmacro %}

{% macro teradata__build_snapshot_table(strategy, sql) %}

select sbq.*,
{{ strategy.scd_id }} as dbt_scd_id,
{{ strategy.updated_at }} as dbt_updated_at,
{{ strategy.updated_at }} as dbt_valid_from,
nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to
from (
{{ sql }}
) sbq

{% endmacro %}
Loading
Loading