Repository: oracle/dbt-oracle (language: python)

Issue:
[Bug] Flaky generic tests on multiple threads
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Installing dbt-oracle 1.4.1 I suffer from https://github.com/dbt-labs/dbt-core/issues/6885 (Flaky generic tests on multiple threads), because it hardly depends on dbt-core 1.4.4.

This issue is already fixed in [dbt-core 1.4.5](https://github.com/dbt-labs/dbt-core/releases/tag/v1.4.5).

Could you bump the dependency from dbt-core from 1.4.4 to 1.4.5 (just as you did in #76)?

### Expected Behavior

generic tests work using multiple threads

### Steps To Reproduce

1. Install dbt-oracle 1.4.1 (and thus dbt-core 1.4.4).
2. Add a generic test.
3. Use multiple threads.
4. Run the tests.

(see https://github.com/dbt-labs/dbt-core/issues/6885 for details)

### Relevant log output using `--debug` flag enabled

_No response_

### Environment

```markdown
- OS: Linux
- Python: 3.8.10
- dbt: 1.4.4
```


### What Oracle database version are you using dbt with?

_No response_

### Additional Context

_No response_
[Feature] parallel insert and merge statements
### Describe the Feature

I would like to have parallel hints added to insert and merge statements based on assigned parameter.

I've achieved this altering oracle__get_incremental_merge_sql macro: 

`
{# added parallel param and parallel hint on line 18 and 34 #}
{% macro oracle__get_incremental_merge_sql(args_dict) %}
    {%- set parallel = config.get('parallel', none) -%}
    {%- set dest_columns = args_dict["dest_columns"] -%}
    {%- set temp_relation = args_dict["temp_relation"] -%}
    {%- set target_relation = args_dict["target_relation"] -%}
    {%- set unique_key = args_dict["unique_key"] -%}
    {%- set dest_column_names = dest_columns | map(attribute='name') | list -%}
    {%- set dest_cols_csv = get_quoted_column_csv(model, dest_column_names)  -%}
    {%- set merge_update_columns = config.get('merge_update_columns') -%}
    {%- set merge_exclude_columns = config.get('merge_exclude_columns') -%}
    {%- set incremental_predicates = args_dict["incremental_predicates"] -%}
    {%- set update_columns = get_merge_update_columns(merge_update_columns, merge_exclude_columns, dest_columns) -%}
    {%- if unique_key -%}
        {%- set unique_key_result = oracle_check_and_quote_unique_key_for_incremental_merge(unique_key, incremental_predicates) -%}
        {%- set unique_key_list = unique_key_result['unique_key_list'] -%}
        {%- set unique_key_merge_predicates = unique_key_result['unique_key_merge_predicates'] -%}
        merge into {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} DBT_INTERNAL_DEST
          using {{ temp_relation }} DBT_INTERNAL_SOURCE
          on ({{ unique_key_merge_predicates | join(' AND ') }})
        when matched then
          update set
          {% for col in update_columns if (col.upper() not in unique_key_list and col not in unique_key_list) -%}
            DBT_INTERNAL_DEST.{{ col }} = DBT_INTERNAL_SOURCE.{{ col }}{% if not loop.last %}, {% endif %}
          {% endfor -%}
        when not matched then
          insert({{ dest_cols_csv }})
          values(
            {% for col in dest_columns -%}
              DBT_INTERNAL_SOURCE.{{ adapter.check_and_quote_identifier(col.name, model.columns) }}{% if not loop.last %}, {% endif %}
            {% endfor -%}
          )
    {%- else -%}
    insert into {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} ({{ dest_cols_csv }})
    (
       select {{ dest_cols_csv }}
       from {{ temp_relation }}
    )
    {%- endif -%}
{% endmacro %}
`



### Describe alternatives you've considered

_No response_

### Who will this benefit?

_No response_

### Anything else?

_No response_


Discussion / hints:

Fix patch:
diff --git a/Makefile b/Makefile
index 18a6a8f..4dbfa0d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 # Configuration variables
-VERSION=1.4.1
+VERSION=1.4.2
 PROJ_DIR?=$(shell pwd)
 VENV_DIR?=${PROJ_DIR}/.bldenv
 BUILD_DIR=${PROJ_DIR}/build
diff --git a/README.md b/README.md
index 5d0a38e..79e937e 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
 
 [![PyPI version](https://badge.fury.io/py/dbt-oracle.svg)](https://pypi.python.org/pypi/dbt-oracle)
 [![dbt-tests-adapter](https://github.com/oracle/dbt-oracle/actions/workflows/oracle-xe-adapter-tests.yml/badge.svg)](https://github.com/oracle/dbt-oracle/actions/workflows/oracle-xe-adapter-tests.yml)
+[![dbt-oracle docs](https://img.shields.io/badge/docs-read-blue)](https://docs.getdbt.com/reference/warehouse-setups/oracle-setup)
+[![dbt-oracle license](https://img.shields.io/badge/license-Apache%202.0-blue)][4]
 
 `dbt-oracle` implements [dbt (data build tool)](https://docs.getdbt.com/docs/introduction) functionalities for the Oracle database. 
 
@@ -11,7 +13,14 @@ From version 1.0.0, dbt-oracle is maintained and distributed by Oracle.
 
 ## Installation
 
-For installation, read how you can set up [Oracle profile][1] for dbt.
+```bash
+pip install dbt-oracle
+```
+
+
+## Documentation
+
+Please refer to the [Oracle setup on dbt docs website][1] for documentation.
 
 ## Sample project
 
diff --git a/dbt/adapters/oracle/__version__.py b/dbt/adapters/oracle/__version__.py
index 486ee04..2fed148 100644
--- a/dbt/adapters/oracle/__version__.py
+++ b/dbt/adapters/oracle/__version__.py
@@ -14,4 +14,4 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 """
-version = "1.4.4"
+version = "1.4.5"
diff --git a/dbt/adapters/oracle/connection_helper.py b/dbt/adapters/oracle/connection_helper.py
index 04e6598..367412a 100644
--- a/dbt/adapters/oracle/connection_helper.py
+++ b/dbt/adapters/oracle/connection_helper.py
@@ -106,7 +106,6 @@ class OracleDriverType(str, enum.Enum):
     description = (
         f"cx_oracle will soon be deprecated, use python-oracledb"
         f"\n\nTo switch to python-oracledb set the environment variable ORA_PYTHON_DRIVER_TYPE=thin "
-        f"or ORA_PYTHON_DRIVER_TYPE=thick"
         f"\n\nRead the guideline here: "
         f"https://docs.getdbt.com/reference/warehouse-setups/oracle-setup#configure-the-python-driver-mode"
         f"\n\nDocumentation for python-oracledb can be found here: "
diff --git a/dbt/include/oracle/macros/adapters.sql b/dbt/include/oracle/macros/adapters.sql
index 2faf8e7..d0476a1 100644
--- a/dbt/include/oracle/macros/adapters.sql
+++ b/dbt/include/oracle/macros/adapters.sql
@@ -114,8 +114,10 @@
     global temporary
   {%- endif %} table {{ relation.include(schema=(not temporary)) }}
   {% if temporary -%} on commit preserve rows {%- endif %}
-  {% if parallel %} parallel {{ parallel }}{% endif %}
-  {% if compression_clause %} {{ compression_clause }} {% endif %}
+  {% if not temporary -%}
+    {% if parallel %} parallel {{ parallel }}{% endif %}
+    {% if compression_clause %} {{ compression_clause }} {% endif %}
+  {%- endif %}
   as
     {{ sql }}
 
diff --git a/dbt/include/oracle/macros/materializations/incremental/strategies.sql b/dbt/include/oracle/macros/materializations/incremental/strategies.sql
index c86f264..4ccd09e 100644
--- a/dbt/include/oracle/macros/materializations/incremental/strategies.sql
+++ b/dbt/include/oracle/macros/materializations/incremental/strategies.sql
@@ -93,12 +93,13 @@
 
 
 {% macro oracle__get_incremental_append_sql(args_dict) %}
+    {%- set parallel = config.get('parallel', none) -%}
     {%- set dest_columns = args_dict["dest_columns"] -%}
     {%- set temp_relation = args_dict["temp_relation"] -%}
     {%- set target_relation = args_dict["target_relation"] -%}
     {%- set dest_column_names = dest_columns | map(attribute='name') | list -%}
     {%- set dest_cols_csv = get_quoted_column_csv(model, dest_column_names)  -%}
-    INSERT INTO {{ target_relation }} ({{ dest_cols_csv }})
+    INSERT INTO {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} ({{ dest_cols_csv }})
     (
        SELECT {{ dest_cols_csv }}
        FROM {{ temp_relation }}
@@ -106,6 +107,7 @@
 {% endmacro %}
 
 {% macro oracle__get_incremental_merge_sql(args_dict) %}
+    {%- set parallel = config.get('parallel', none) -%}
     {%- set dest_columns = args_dict["dest_columns"] -%}
     {%- set temp_relation = args_dict["temp_relation"] -%}
     {%- set target_relation = args_dict["target_relation"] -%}
@@ -120,7 +122,7 @@
         {%- set unique_key_result = oracle_check_and_quote_unique_key_for_incremental_merge(unique_key, incremental_predicates) -%}
         {%- set unique_key_list = unique_key_result['unique_key_list'] -%}
         {%- set unique_key_merge_predicates = unique_key_result['unique_key_merge_predicates'] -%}
-        merge into {{ target_relation }} DBT_INTERNAL_DEST
+        merge into {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} DBT_INTERNAL_DEST
           using {{ temp_relation }} DBT_INTERNAL_SOURCE
           on ({{ unique_key_merge_predicates | join(' AND ') }})
         when matched then
@@ -136,7 +138,7 @@
             {% endfor -%}
           )
     {%- else -%}
-    insert into {{ target_relation }} ({{ dest_cols_csv }})
+    insert into {% if parallel %} /*+parallel({{ parallel }})*/ {% endif %} {{ target_relation }} ({{ dest_cols_csv }})
     (
        select {{ dest_cols_csv }}
        from {{ temp_relation }}
diff --git a/requirements.txt b/requirements.txt
index 01cb665..aaa2032 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-dbt-core==1.4.4
+dbt-core==1.4.5
 cx_Oracle==8.3.0
 oracledb==1.2.2
 
diff --git a/requirements_dev.txt b/requirements_dev.txt
index b76eefb..cadc816 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -6,4 +6,4 @@ tox
 coverage
 twine
 pytest
-dbt-tests-adapter==1.4.4
\ No newline at end of file
+dbt-tests-adapter==1.4.5
\ No newline at end of file
diff --git a/setup.cfg b/setup.cfg
index 4413add..fc0667c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = dbt-oracle
-version = 1.4.1
+version = 1.4.2
 description = dbt (data build tool) adapter for the Oracle database
 long_description = file: README.md
 long_description_content_type = text/markdown
@@ -33,12 +33,12 @@ zip_safe = False
 packages = find:
 include_package_data = True
 install_requires =
-    dbt-core==1.4.4
+    dbt-core==1.4.5
     cx_Oracle==8.3.0
     oracledb==1.2.2
 test_suite=tests
 test_requires =
-    dbt-tests-adapter==1.4.4
+    dbt-tests-adapter==1.4.5
     pytest
 scripts =
     bin/create-pem-from-p12
diff --git a/setup.py b/setup.py
index 714cc02..a747332 100644
--- a/setup.py
+++ b/setup.py
@@ -32,13 +32,13 @@
 
 
 requirements = [
-        "dbt-core==1.4.4",
+        "dbt-core==1.4.5",
         "cx_Oracle==8.3.0",
         "oracledb==1.2.2"
 ]
 
 test_requirements = [
-    "dbt-tests-adapter==1.4.4",
+    "dbt-tests-adapter==1.4.5",
     "pytest"
 ]
 
@@ -52,7 +52,7 @@
 
 url = 'https://github.com/oracle/dbt-oracle'
 
-VERSION = '1.4.1'
+VERSION = '1.4.2'
 setup(
     author="Oracle",
     python_requires='>=3.7.2',
diff --git a/tox.ini b/tox.ini
index 8504a93..9ec8920 100644
--- a/tox.ini
+++ b/tox.ini
@@ -15,7 +15,7 @@ passenv =
 
 deps =
     -rrequirements.txt
-    dbt-tests-adapter==1.4.4
+    dbt-tests-adapter==1.4.5
     pytest
 
 commands = pytest


Test patch:
diff --git a/.github/workflows/oracle-xe-adapter-tests.yml b/.github/workflows/oracle-xe-adapter-tests.yml
index 4ecf53f..58424aa 100644
--- a/.github/workflows/oracle-xe-adapter-tests.yml
+++ b/.github/workflows/oracle-xe-adapter-tests.yml
@@ -48,7 +48,7 @@ jobs:
       - name: Install dbt-oracle with core dependencies
         run: |
           python -m pip install --upgrade pip
-          pip install pytest dbt-tests-adapter==1.4.4
+          pip install pytest dbt-tests-adapter==1.4.5
           pip install -r requirements.txt
           pip install -e .
 
diff --git a/dbt_adbs_test_project/models/us_product_sales_channel_ranking.sql b/dbt_adbs_test_project/models/us_product_sales_channel_ranking.sql
index f0096e7..309d72f 100644
--- a/dbt_adbs_test_project/models/us_product_sales_channel_ranking.sql
+++ b/dbt_adbs_test_project/models/us_product_sales_channel_ranking.sql
@@ -16,7 +16,9 @@
 {{
     config(
         materialized='incremental',
-        unique_key='group_id')
+        unique_key='group_id',
+        parallel=4,
+        table_compression_clause='COLUMN STORE COMPRESS FOR QUERY LOW')
 }}
 
 SELECT prod_name, channel_desc, calendar_month_desc,
diff --git a/dbt_adbs_test_project/models/us_product_sales_channel_ranking_append.sql b/dbt_adbs_test_project/models/us_product_sales_channel_ranking_append.sql
new file mode 100644
index 0000000..8edc470
--- /dev/null
+++ b/dbt_adbs_test_project/models/us_product_sales_channel_ranking_append.sql
@@ -0,0 +1,43 @@
+{#
+ Copyright (c) 2022, Oracle and/or its affiliates.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+     https://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+#}
+{{
+    config(
+        materialized='incremental',
+        incremental_strategy='append',
+        parallel=4,
+        table_compression_clause='COLUMN STORE COMPRESS FOR QUERY LOW')
+}}
+
+SELECT prod_name, channel_desc, calendar_month_desc,
+   {{ snapshot_hash_arguments(['prod_name', 'channel_desc', 'calendar_month_desc']) }} AS group_id,
+   TO_CHAR(SUM(amount_sold), '9,999,999,999') SALES$,
+   RANK() OVER (ORDER BY SUM(amount_sold)) AS default_rank,
+   RANK() OVER (ORDER BY SUM(amount_sold) DESC NULLS LAST) AS custom_rank
+FROM {{ source('sh_database', 'sales') }}, {{ source('sh_database', 'products') }}, {{ source('sh_database', 'customers') }},
+     {{ source('sh_database', 'times') }}, {{ source('sh_database', 'channels') }}, {{ source('sh_database', 'countries') }}
+WHERE sales.prod_id=products.prod_id AND sales.cust_id=customers.cust_id
+  AND customers.country_id = countries.country_id AND sales.time_id=times.time_id
+  AND sales.channel_id=channels.channel_id
+  AND country_iso_code='US'
+
+{% if is_incremental() %}
+
+  AND times.calendar_month_desc > (SELECT MAX(calendar_month_desc) FROM {{ this }})
+
+{% endif %}
+
+GROUP BY prod_name, channel_desc, calendar_month_desc
+