From eee6176315d76e4d5fe37559c0033685a40e6a24 Mon Sep 17 00:00:00 2001 From: M1083 Date: Sat, 27 Jan 2024 18:04:23 +0300 Subject: [PATCH] hw_mukhin --- .env.template | 2 +- models/marts/f_lineorder_flat.sql | 5 +++++ models/marts/f_orders_stats.sql | 6 ++++++ profiles.yml | 15 ++++++++------- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.env.template b/.env.template index 5fea79e..7ad9154 100644 --- a/.env.template +++ b/.env.template @@ -1,2 +1,2 @@ -CLICKHOUSE_USER=admin1 +CLICKHOUSE_USER=admin TF_VAR_clickhouse_password=clickhouse \ No newline at end of file diff --git a/models/marts/f_lineorder_flat.sql b/models/marts/f_lineorder_flat.sql index ef38528..0ef120e 100644 --- a/models/marts/f_lineorder_flat.sql +++ b/models/marts/f_lineorder_flat.sql @@ -6,6 +6,8 @@ ) }} + +with f_lo_f as ( SELECT L_ITEMKEY @@ -68,3 +70,6 @@ FROM {{ ref('stg_lineitem') }} AS l INNER JOIN {{ ref('stg_customer') }} AS c ON c.C_CUSTKEY = o.O_CUSTKEY INNER JOIN {{ ref('stg_supplier') }} AS s ON s.S_SUPPKEY = l.L_SUPPKEY INNER JOIN {{ ref('stg_part') }} AS p ON p.P_PARTKEY = l.L_PARTKEY +) +SELECT * + from f_lo_f \ No newline at end of file diff --git a/models/marts/f_orders_stats.sql b/models/marts/f_orders_stats.sql index 7344c3e..6f504e5 100644 --- a/models/marts/f_orders_stats.sql +++ b/models/marts/f_orders_stats.sql @@ -5,6 +5,9 @@ ) }} + +with f_o_s AS +( SELECT toYear(O_ORDERDATE) AS O_ORDERYEAR , O_ORDERSTATUS @@ -20,3 +23,6 @@ GROUP BY toYear(O_ORDERDATE) , O_ORDERSTATUS , O_ORDERPRIORITY +) +SELECT * + from f_o_s \ No newline at end of file diff --git a/profiles.yml b/profiles.yml index 80d07a6..574f1fd 100644 --- a/profiles.yml +++ b/profiles.yml @@ -11,14 +11,15 @@ clickhouse_starschema: host: "{{ env_var('DBT_HOST') }}" port: 8443 user: admin #"{{ env_var('DBT_USER') }}" - password: clickhouse #clickhouse #"{{ env_var('DBT_PASSWORD') }}" + password: clickhouse + #clickhouse #"{{ env_var('DBT_PASSWORD') }}" secure: True verify: False # socket_timeout: 300000 - ci: - type: clickhouse - host: clickhouse - port: 8123 - schema: default - threads: 4 + # ci: + # type: clickhouse + # host: clickhouse + # port: 8123 + # schema: default + # threads: 4 target: dev