Skip to content

Commit

Permalink
dbt: Start using dbt-cratedb2
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Nov 26, 2024
1 parent 194a310 commit a714523
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 111 deletions.
43 changes: 0 additions & 43 deletions framework/dbt/basic/macros/catalog.sql

This file was deleted.

33 changes: 2 additions & 31 deletions framework/dbt/basic/macros/overrides.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@

{%- endmacro %}

{% macro postgres__create_schema(relation) -%}
{%- call statement('create_schema') -%}
/* schemas are not created in CrateDB */
DROP TABLE IF EXISTS thisschemadefinitelydoesnotexits.thiswouldnotexist
/* but we need to run something to not have just EOF */
{% endcall %}
{% endmacro %}

{% macro postgres__create_table_as(temporary, relation, sql) -%}
{% macro cratedb__create_table_as(temporary, relation, sql) -%}
{%- set unlogged = config.get('unlogged', default=false) -%}
{%- set sql_header = config.get('sql_header', none) -%}

Expand All @@ -46,27 +38,6 @@
);
{%- endmacro %}

{% macro postgres__drop_schema(relation) -%}
{% if relation.database -%}
{{ adapter.verify_database(relation.database) }}
{%- endif -%}
{%- call statement('drop_schema') -%}
/* schemas are not dropped in CrateDB */
{%- endcall -%}
{% endmacro %}

{% macro default__drop_relation(relation) -%}
{% call statement('drop_relation', auto_begin=False) -%}
drop {{ relation.type }} if exists "{{ relation.schema }}"."{{ relation.identifier }}"
{%- endcall %}
{% endmacro %}

{% macro default__drop_schema(relation) -%}
{%- call statement('drop_schema') -%}
/* schemas are not dropped in CrateDB */
{% endcall %}
{% endmacro %}

{% macro default__create_view_as(relation, sql) -%}
{%- set sql_header = config.get('sql_header', none) -%}

Expand All @@ -76,7 +47,7 @@
;
{%- endmacro %}

{% macro postgres__rename_relation(from_relation, to_relation) -%}
{% macro cratedb__rename_relation(from_relation, to_relation) -%}
{% do drop_relation(to_relation) %}
{% set schema_query = "SELECT table_type FROM information_schema.tables WHERE table_schema = '{}' AND table_name = '{}'".format(from_relation.schema, from_relation.identifier) %}
{% set results = run_query(schema_query) %}
Expand Down
34 changes: 0 additions & 34 deletions framework/dbt/basic/macros/relations.sql

This file was deleted.

2 changes: 1 addition & 1 deletion framework/dbt/basic/profiles.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cratedb_localhost:
outputs:
dev:
type: postgres
type: cratedb
host: localhost
user: crate
pass: crate
Expand Down
3 changes: 1 addition & 2 deletions framework/dbt/basic/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
dbt-postgres<1.7
snowplow-tracker<0.13
dbt-cratedb2>=0.0.1dev2

0 comments on commit a714523

Please sign in to comment.