Skip to content

Commit

Permalink
v1.7.2: kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
amoghparab1805 committed Feb 8, 2024
1 parent 5e2b4e4 commit cbb370a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dbt/include/oracle/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
{%- if col['data_type'] is not defined -%}
{{ col_err.append(col['name']) }}
{%- endif -%}
cast(null as {{ col['data_type'] }}) as {{ col['name'] }}{{ ", " if not loop.last }}
{%- if col['data_type'] | lower == 'clob' -%}
empty_clob() as {{ col['name'] }}{{ ", " if not loop.last }}
{%- else -%}
cast(null as {{ col['data_type'] }}) as {{ col['name'] }}{{ ", " if not loop.last }}
{%- endif -%}
{%- endfor -%}
{# Override for Oracle #}
from dual
Expand Down Expand Up @@ -268,7 +272,7 @@
{% set comment = column_dict[column_name]['description'] %}
{% set escaped_comment = oracle_escape_comment(comment) %}
{% call statement('alter _column comment', fetch_result=False) -%}
comment on column {{ relation }}.{{ column_name }} is {{ escaped_comment }}
comment on column {{ relation }}.{{ adapter.check_and_quote_identifier(column_name, model.columns) }} is {{ escaped_comment }}
{%- endcall %}
{% endfor %}
{% endif %}
Expand Down Expand Up @@ -384,7 +388,7 @@
else 'BASE TABLE'
end table_type
from sys.all_tables
where upper(table_name) not in (select upper(mview_name) from sys.all_mviews)
where upper(table_name) not in (select upper(mview_name) from sys.all_mviews where upper(owner) = upper('{{ schema_relation.schema }}'))
union all
select SYS_CONTEXT('userenv', 'DB_NAME'),
owner,
Expand Down
3 changes: 3 additions & 0 deletions dbt_adbs_test_project/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ quoting:
seeds:
dbt_adbs_test_project:
quote_columns: false
kafka_message:
+column_types:
message: CLOB
seed_with_empty_col:
+column_types:
id: number
Expand Down
1 change: 1 addition & 0 deletions dbt_adbs_test_project/models/kafka.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from {{ ref('kafka_message') }}
19 changes: 19 additions & 0 deletions dbt_adbs_test_project/models/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ sources:
- name: costs

models:
- name: kafka
description: kafka_description
config:
materialized: incremental
incremental_strategy: append
on_schema_change: fail
full_refresh: false
contract:
enforced: true
constraints:
- type: not_null
columns: [message]
columns:
- name: message
description: Kafka message
data_type: CLOB
constraints:
- type: not_null

- name: people
columns:
- name: id
Expand Down
5 changes: 5 additions & 0 deletions dbt_adbs_test_project/seeds/kafka_message.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message
Jack-Hunter
Jack-Hunter
Jack-HunterJackHunter
Jack-Hunter

0 comments on commit cbb370a

Please sign in to comment.