From 40b096f71a202e7425d7181d96d9edd2e16e0714 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Mon, 1 Jul 2024 14:57:19 -0700 Subject: [PATCH 1/2] Fix ORA-12098: cannot comment on the materialized view --- dbt/include/oracle/macros/adapters.sql | 4 ++++ dbt_adbs_test_project/models/sales_internet_mv.sql | 2 +- dbt_adbs_test_project/models/schema.yml | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dbt/include/oracle/macros/adapters.sql b/dbt/include/oracle/macros/adapters.sql index 1048127..6d3b8af 100644 --- a/dbt/include/oracle/macros/adapters.sql +++ b/dbt/include/oracle/macros/adapters.sql @@ -260,8 +260,12 @@ {% macro oracle__alter_relation_comment(relation, comment) %} {% set escaped_comment = oracle_escape_comment(comment) %} + {% if relation.type == 'materialized_view' %} + comment on materialized view {{ relation }} is {{ escaped_comment }} + {% else %} {# "comment on table" even for views #} comment on table {{ relation }} is {{ escaped_comment }} + {% endif %} {% endmacro %} {% macro oracle__persist_docs(relation, model, for_relation, for_columns) -%} diff --git a/dbt_adbs_test_project/models/sales_internet_mv.sql b/dbt_adbs_test_project/models/sales_internet_mv.sql index b8be090..244f86b 100644 --- a/dbt_adbs_test_project/models/sales_internet_mv.sql +++ b/dbt_adbs_test_project/models/sales_internet_mv.sql @@ -13,6 +13,6 @@ See the License for the specific language governing permissions and limitations under the License. #} -{{ config(materialized='materialized_view')}} +{{ config(materialized='materialized_view', persist_docs={"relation": true, "columns": true}) }} select * from {{ source('sh_database', 'sales') }} where channel_id = 5 diff --git a/dbt_adbs_test_project/models/schema.yml b/dbt_adbs_test_project/models/schema.yml index 9f3d26e..2a577d0 100644 --- a/dbt_adbs_test_project/models/schema.yml +++ b/dbt_adbs_test_project/models/schema.yml @@ -22,6 +22,9 @@ sources: - name: costs models: + - name: sales_internet_mv + description: Test comment for Materialized View + - name: kafka description: kafka_description config: From bf5e717b4119d820dbc6ea93a3b1a164135cdddf Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Mon, 1 Jul 2024 15:22:29 -0700 Subject: [PATCH 2/2] Upgraded version to 1.7.7 --- Makefile | 2 +- dbt/adapters/oracle/__version__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0253c39..0ba37be 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Configuration variables -VERSION=1.7.6 +VERSION=1.7.7 PROJ_DIR?=$(shell pwd) VENV_DIR?=${PROJ_DIR}/.bldenv BUILD_DIR=${PROJ_DIR}/build diff --git a/dbt/adapters/oracle/__version__.py b/dbt/adapters/oracle/__version__.py index 4fb8d1d..4529925 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.7.16" +version = "1.7.17" diff --git a/setup.cfg b/setup.cfg index 6dc7aee..e931aca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = dbt-oracle -version = 1.7.6 +version = 1.7.7 description = dbt (data build tool) adapter for Oracle Autonomous Database long_description = file: README.md long_description_content_type = text/markdown diff --git a/setup.py b/setup.py index 5a55d7c..0c58851 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ url = 'https://github.com/oracle/dbt-oracle' -VERSION = '1.7.6' +VERSION = '1.7.7' setup( author="Oracle", python_requires='>=3.8',