Skip to content

Commit

Permalink
Bolotyuk Dmitry
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBolo committed Jun 9, 2024
1 parent 7d8c554 commit c002621
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .env.template

This file was deleted.

13 changes: 6 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "yandex_mdb_clickhouse_cluster" "clickhouse_starschema" {
sql_database_management = true
sql_user_management = true
admin_password = var.clickhouse_password
version = "23.3"
version = "23.8"

clickhouse {
resources {
Expand All @@ -39,21 +39,20 @@ resource "yandex_mdb_clickhouse_cluster" "clickhouse_starschema" {
timezone = "UTC"
geobase_uri = ""
query_log_retention_size = 1073741824
query_log_retention_time = 2592000
query_thread_log_enabled = true
query_thread_log_retention_size = 536870912
query_thread_log_retention_time = 2592000

part_log_retention_size = 536870912
part_log_retention_time = 2592000

metric_log_enabled = true
metric_log_retention_size = 536870912
metric_log_retention_time = 2592000

trace_log_enabled = true
trace_log_retention_size = 536870912
trace_log_retention_time = 2592000

text_log_enabled = true
text_log_retention_size = 536870912
text_log_retention_time = 2592000

text_log_level = "TRACE"
background_pool_size = 16
background_schedule_pool_size = 16
Expand Down
19 changes: 18 additions & 1 deletion models/marts/f_orders_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,21 @@
)
}}

SELECT 1
SELECT
toYear(O_ORDERDATE) AS O_ORDERYEAR
, O_ORDERSTATUS
, O_ORDERPRIORITY
, count(DISTINCT O_ORDERKEY) AS num_orders
, count(DISTINCT C_CUSTKEY) AS num_customers
, sum(L_EXTENDEDPRICE * L_DISCOUNT) AS revenue
FROM {{ ref('stg_lineitem') }} AS l
INNER JOIN {{ ref('stg_orders') }} AS o ON o.O_ORDERKEY = l.L_ORDERKEY
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

WHERE 1=1
GROUP BY
toYear(O_ORDERDATE)
, O_ORDERSTATUS
, O_ORDERPRIORITY
4 changes: 4 additions & 0 deletions package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages:
- package: dbt-labs/dbt_utils
version: 1.0.0
sha1_hash: f4c10e8eb3db97171ea98d4851377e010cce1478

0 comments on commit c002621

Please sign in to comment.