Skip to content

Commit bfacc38

Browse files
authored
Merge pull request #200 from oracle/dev/v1.12.0
v1.12.0
2 parents 16d6b27 + 5de72fb commit bfacc38

43 files changed

Lines changed: 278 additions & 136 deletions

Some content is hidden

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

.github/scripts/create_new_user.sh

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,14 @@ set -Exeuo pipefail
44

55
# Parameters
66
DB_USER="${1}"
7-
DB_PASSWORD="${2}"
8-
TARGET_PDB="${3:-FREEPDB1}"
7+
ADMIN_PASSWORD="${2}"
8+
DB_PASSWORD="${3}"
99

10-
# Prepare container switch statement to create user in PDB.
11-
ALTER_SESSION_CMD="ALTER SESSION SET CONTAINER=${TARGET_PDB};"
12-
13-
# 11g XE does not support PDBs, set container switch statement to empty string.
14-
ORACLE_VERSION=$(sqlplus -version | grep "Release" | awk '{ print $3 }')
15-
if [[ "${ORACLE_VERSION}" = "11.2"* ]]; then
16-
ALTER_SESSION_CMD="";
17-
fi;
18-
19-
# Create new user in target PDB
20-
sqlplus -s / as sysdba << EOF
10+
# Create the user through the ADB administrator account.
11+
sqlplus -s "admin/${ADMIN_PASSWORD}@localhost:1521/myatp" << EOF
2112
-- Exit on any errors
2213
WHENEVER SQLERROR EXIT SQL.SQLCODE
23-
${ALTER_SESSION_CMD}
24-
CREATE USER ${DB_USER} IDENTIFIED BY "${DB_PASSWORD}" QUOTA UNLIMITED ON SYSTEM;
25-
GRANT DB_DEVELOPER_ROLE TO ${DB_USER};
14+
CREATE USER ${DB_USER} IDENTIFIED BY "${DB_PASSWORD}" QUOTA UNLIMITED ON DATA;
15+
GRANT CONNECT, CONSOLE_DEVELOPER, DWROLE, RESOURCE TO ${DB_USER};
2616
exit;
2717
EOF
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
sudo apt-get update
22
sudo apt-get install wget libaio1t64
33
sudo mkdir -p /opt/oracle
4-
wget https://download.oracle.com/otn_software/linux/instantclient/2370000/instantclient-basiclite-linux.x64-23.7.0.25.01.zip -P /tmp
5-
sudo unzip /tmp/instantclient-basiclite-linux.x64-23.7.0.25.01.zip -d /opt/oracle
6-
export PATH="$PATH:/opt/oracle/instantclient_23_7"
7-
export LD_LIBRARY_PATH="/opt/oracle/instantclient_23_7:$LD_LIBRARY_PATH"
4+
wget https://download.oracle.com/otn_software/linux/instantclient/2326300/instantclient-basiclite-linux.x64-23.26.3.0.0.zip -P /tmp
5+
sudo unzip /tmp/instantclient-basiclite-linux.x64-23.26.3.0.0.zip -d /opt/oracle
6+
export PATH="$PATH:/opt/oracle/instantclient_23_26"
7+
export LD_LIBRARY_PATH="/opt/oracle/instantclient_23_26:$LD_LIBRARY_PATH"
88
sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
99
sudo mkdir -p /opt/tns_admin
1010
echo "DISABLE_OOB=ON" >> /opt/tns_admin/sqlnet.ora
11-

.github/workflows/tests.yaml

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: dbt-tests-adapter
22
on:
33
push:
4+
branches:
5+
- "**"
46
workflow_call:
57

68
permissions:
@@ -13,23 +15,30 @@ jobs:
1315
fail-fast: true
1416
matrix:
1517
os: [ ubuntu-latest ]
16-
python-version: ['3.10', '3.11', '3.12', '3.13']
18+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
1719

1820
services:
19-
oracle_db:
20-
image: container-registry.oracle.com/database/free:latest-lite
21+
adb:
22+
image: ghcr.io/oracle/adb-free:latest-26ai
2123
env:
22-
ORACLE_PWD: ${{ secrets.DBT_ORACLE_PASSWORD }}
23-
options: --name oracle_db
24+
WORKLOAD_TYPE: ATP
25+
START_ORDS: "False"
26+
ENABLE_ARCHIVE_LOG: "False"
27+
ADMIN_PASSWORD: ${{ secrets.DBT_ORACLE_ADMIN_PASSWORD }}
28+
WALLET_PASSWORD: ${{ secrets.DBT_ORACLE_TEST_WALLET_PASSWORD }}
2429
ports:
2530
- 1521:1521
31+
options: >-
32+
--name adb
33+
--cap-add SYS_ADMIN
34+
--device /dev/fuse
2635
2736
steps:
2837
- name: Check out dbt-oracle repository code
29-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
38+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3039

3140
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
41+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
3342
with:
3443
python-version: ${{ matrix.python-version }}
3544

@@ -38,27 +47,24 @@ jobs:
3847
chmod +x ${{ github.workspace }}/.github/scripts/install_oracle_instantclient.sh
3948
${{ github.workspace }}/.github/scripts/install_oracle_instantclient.sh
4049
41-
- name: Copy Create User script
42-
run: |
43-
chmod +x ${{ github.workspace }}/.github/scripts/create_new_user.sh
44-
docker cp ${{ github.workspace }}/.github/scripts/create_new_user.sh oracle_db:/home/oracle/create_new_user.sh
45-
4650
- name: Create dbt test users
4751
run: |
48-
docker exec oracle_db /home/oracle/create_new_user.sh dbt_test ${{ secrets.DBT_ORACLE_PASSWORD }}
49-
docker exec oracle_db /home/oracle/create_new_user.sh dbt_test_user_1 ${{ secrets.DBT_ORACLE_PASSWORD }}
50-
docker exec oracle_db /home/oracle/create_new_user.sh dbt_test_user_2 ${{ secrets.DBT_ORACLE_PASSWORD }}
51-
docker exec oracle_db /home/oracle/create_new_user.sh dbt_test_user_3 ${{ secrets.DBT_ORACLE_PASSWORD }}
52+
chmod +x ${{ github.workspace }}/.github/scripts/create_new_user.sh
53+
docker cp ${{ github.workspace }}/.github/scripts/create_new_user.sh adb:/tmp/create_new_user.sh
54+
docker exec adb /tmp/create_new_user.sh dbt_test \
55+
'${{ secrets.DBT_ORACLE_ADMIN_PASSWORD }}' '${{ secrets.DBT_ORACLE_PASSWORD }}'
56+
docker exec adb /tmp/create_new_user.sh dbt_test_user_1 \
57+
'${{ secrets.DBT_ORACLE_ADMIN_PASSWORD }}' '${{ secrets.DBT_ORACLE_PASSWORD }}'
58+
docker exec adb /tmp/create_new_user.sh dbt_test_user_2 \
59+
'${{ secrets.DBT_ORACLE_ADMIN_PASSWORD }}' '${{ secrets.DBT_ORACLE_PASSWORD }}'
60+
docker exec adb /tmp/create_new_user.sh dbt_test_user_3 \
61+
'${{ secrets.DBT_ORACLE_ADMIN_PASSWORD }}' '${{ secrets.DBT_ORACLE_PASSWORD }}'
5262
5363
- name: Install dbt-oracle with core dependencies
5464
run: |
5565
python -m pip install --upgrade pip
5666
pip install -e '.[test]'
5767
58-
- name: Check create-pem-from-p12 script is installed in bin
59-
run: |
60-
create-pem-from-p12 --help
61-
6268
- name: Run adapter tests - ORA_PYTHON_DRIVER_TYPE => THICK
6369
run: |
6470
pytest -v
@@ -69,10 +75,10 @@ jobs:
6975
DBT_ORACLE_PORT: 1521
7076
DBT_ORACLE_SCHEMA: DBT_TEST
7177
DBT_ORACLE_PASSWORD: ${{ secrets.DBT_ORACLE_PASSWORD }}
72-
DBT_ORACLE_DATABASE: FREEPDB1
73-
DBT_ORACLE_SERVICE: FREEPDB1
78+
DBT_ORACLE_DATABASE: MYATP
79+
DBT_ORACLE_SERVICE: MYATP
7480
DBT_ORACLE_PROTOCOL: tcp
75-
LD_LIBRARY_PATH: /opt/oracle/instantclient_23_7
81+
LD_LIBRARY_PATH: /opt/oracle/instantclient_23_26
7682
TNS_ADMIN: /opt/tns_admin
7783
DBT_TEST_USER_1: DBT_TEST_USER_1
7884
DBT_TEST_USER_2: DBT_TEST_USER_2
@@ -88,8 +94,8 @@ jobs:
8894
DBT_ORACLE_PORT: 1521
8995
DBT_ORACLE_SCHEMA: DBT_TEST
9096
DBT_ORACLE_PASSWORD: ${{ secrets.DBT_ORACLE_PASSWORD }}
91-
DBT_ORACLE_DATABASE: FREEPDB1
92-
DBT_ORACLE_SERVICE: FREEPDB1
97+
DBT_ORACLE_DATABASE: MYATP
98+
DBT_ORACLE_SERVICE: MYATP
9399
DBT_ORACLE_PROTOCOL: tcp
94100
DISABLE_OOB: on
95101
TNS_ADMIN: /opt/tns_admin

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Configuration variables
2-
VERSION=1.11.1
2+
VERSION=1.12.0
33
PROJ_DIR?=$(shell pwd)
44
VENV_DIR?=${PROJ_DIR}/.bldenv
55
BUILD_DIR=${PROJ_DIR}/build

dbt/adapters/oracle/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17-
version = "1.11.1"
17+
version = "1.12.0"

dbt_adbs_test_project/README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ dbt --version
2121

2222
```text
2323
Core:
24-
- installed: 1.3.0
25-
- latest: 1.3.0 - Up to date!
24+
- installed: 1.12.0
25+
- latest: 1.12.0 - Up to date!
2626
```
2727

2828
### Check database connectivity
@@ -32,7 +32,7 @@ dbt debug --profiles-dir ./
3232
```
3333

3434
```text
35-
dbt version: 1.3.0
35+
dbt version: 1.12.0
3636
python version: 3.8.13
3737
..
3838
..
@@ -65,12 +65,27 @@ After this, you can test various dbt features included in this project
6565
| Generic Test - Accepted values | `dbt test` | [schema.yml](./models/schema.yml)
6666
| Generic Test - Relationships | `dbt test` | [schema.yml](./models/schema.yml)
6767
| Operations | `dbt run-operation` | Check [macros](macros)
68+
| v1.12 ad hoc operation | `dbt run-operation --sql "select 1 from dual"` | Executes an Oracle statement without a macro |
69+
| v1.12 named selector composition | `dbt ls --select selector:sample_models` | [selectors.yml](selectors.yml) |
70+
| v1.12 downstream failure behavior | `dbt run -s sales_cost_incremental+` | `on_error: continue` in [properties.yml](models/properties.yml) |
6871
| Snapshots | `dbt snapshot` | Check [snapshots](snapshots)
6972
| Analyses | `dbt compile` | [eu_customers.sql](./analysis/eu_customers.sql)
7073
| Exposures | `dbt run` or `dbt test` | [exposures.yml](./models/exposures.yml)
7174
| Generate documentation | `dbt docs generate` |
7275
| Serve project documentation on port 8080 | `dbt docs serve`
7376

77+
## dbt Core v1.12 compatibility
78+
79+
The project uses the v1.12 generic-test `arguments` syntax and validates the
80+
new `run-operation --sql`, `selector:` selection method, and `on_error` model
81+
configuration. The opt-in v2 parser is not currently usable with `dbt-oracle`:
82+
the bundled experimental parser does not yet recognize the Oracle adapter.
83+
84+
`dbt_constraints` 1.0.9 is the latest supported package release, but its
85+
published macro documentation does not match its macro signatures. With dbt
86+
1.12's default macro-argument validation enabled, dbt therefore emits warnings
87+
for that dependency. They are not caused by this project's macros or schema.
88+
7489

7590
## Tests [TODO]
7691
- Metrics - Experimental feature introduced in dbt-core==1.0.0

dbt_adbs_test_project/models/properties.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ models:
33
- name: sales_cost_incremental
44
config:
55
post-hook: "SELECT COUNT(*) FROM sales_cost_incremental"
6+
# dbt Core v1.12: allow unrelated downstream branches to continue after a failure.
7+
on_error: continue

dbt_adbs_test_project/models/schema.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ models:
6060
- name: gender
6161
tests:
6262
- accepted_values:
63-
values: ['Male', 'Female']
63+
arguments:
64+
values: ['Male', 'Female']
6465
- name: countries
6566
columns:
6667
- name: country_id
@@ -73,10 +74,10 @@ models:
7374
- name: country_id
7475
tests:
7576
- relationships:
76-
to: ref('countries')
77-
field: country_id
77+
arguments:
78+
to: ref('countries')
79+
field: country_id
7880
- dbt_constraints.foreign_key:
79-
pk_table_name: ref('countries')
80-
pk_column_name: country_id
81-
82-
81+
arguments:
82+
pk_table_name: ref('countries')
83+
pk_column_name: country_id
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
packages:
2-
- package: dbt-labs/dbt_utils
3-
version: 0.8.6
4-
- package: Snowflake-Labs/dbt_constraints
5-
version: 0.4.2
6-
sha1_hash: 7664cb2e33183f39e86a72079d63607e43a50ad8
2+
- name: dbt_utils
3+
package: dbt-labs/dbt_utils
4+
version: 1.4.1
5+
- name: dbt_constraints
6+
package: Snowflake-Labs/dbt_constraints
7+
version: 1.0.9
8+
sha1_hash: b9f858fcf43fd74717c56899e55ceaf1c1789d10

dbt_adbs_test_project/packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
packages:
22
- package: dbt-labs/dbt_utils
3-
version: 0.8.6
3+
version: 1.4.1
44
- package: Snowflake-Labs/dbt_constraints
5-
version: [">=0.4.0", "<0.5.0"]
5+
version: 1.0.9

0 commit comments

Comments
 (0)