-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gnosischain/dbt_configs
Configs
- Loading branch information
Showing
6 changed files
with
97 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CLICKHOUSE_URL | ||
CLICKHOUSE_PORT | ||
CLICKHOUSE_USER | ||
CLICKHOUSE_PASSWORD | ||
CLICKHOUSE_SECURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
services: | ||
dbt: | ||
container_name: dbt | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
USER_ID: ${USER_ID:-1000} | ||
GROUP_ID: ${GROUP_ID:-1000} | ||
restart: unless-stopped | ||
ports: | ||
- "8080:8000" | ||
command: > | ||
/bin/bash -c "exec python -m http.server 8000 --directory logs & tail -f /dev/null" | ||
environment: | ||
CLICKHOUSE_USER: ${CLICKHOUSE_USER} | ||
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD} | ||
CLICKHOUSE_URL: ${CLICKHOUSE_URL} | ||
CLICKHOUSE_PORT: ${CLICKHOUSE_PORT} | ||
CLICKHOUSE_SECURE: ${CLICKHOUSE_SECURE} | ||
volumes: | ||
- type: bind | ||
source: ./ | ||
target: /app | ||
consistency: cached | ||
- ./profiles.yml:/home/appuser/.dbt/profiles.yml | ||
working_dir: /app | ||
user: appuser | ||
networks: | ||
- dbt_net | ||
|
||
|
||
networks: | ||
dbt_net: |
28 changes: 10 additions & 18 deletions
28
models/transformations/power_consumption/consensus_power.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
WITH consensus_power AS ( | ||
SELECT * FROM ( | ||
VALUES | ||
(4, 'Lighthouse', 2.75), | ||
(5, 'Lighthouse', 3.14), | ||
(6, 'Lighthouse', 18.84), | ||
(4, 'Teku', 3.71), | ||
(5, 'Teku', 3.32), | ||
(6, 'Teku', 27.46), | ||
(4, 'Lodestar', 3.14), | ||
(5, 'Lodestar', 3.89), | ||
(6, 'Lodestar', 33.55), | ||
(4, 'Nimbus', 1.67), | ||
(5, 'Nimbus', 2.08), | ||
(6, 'Nimbus', 17.11), | ||
(4, 'Prysm', 3.51), | ||
(5, 'Prysm', 2.87), | ||
(6, 'Prysm', 24.33) | ||
) AS t(type, client, mean) | ||
SELECT | ||
type, | ||
client, | ||
mean | ||
FROM ( | ||
SELECT | ||
arrayJoin([4, 5, 6, 4, 5, 6, 4, 5, 6, 4, 5, 6, 4, 5, 6]) AS type, | ||
arrayJoin(['Lighthouse', 'Lighthouse', 'Lighthouse', 'Teku', 'Teku', 'Teku', 'Lodestar', 'Lodestar', 'Lodestar', 'Nimbus', 'Nimbus', 'Nimbus', 'Prysm', 'Prysm', 'Prysm']) AS client, | ||
arrayJoin([2.75, 3.14, 18.84, 3.71, 3.32, 27.46, 3.14, 3.89, 33.55, 1.67, 2.08, 17.11, 3.51, 2.87, 24.33]) AS mean | ||
) | ||
) | ||
|
||
SELECT * FROM consensus_power |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
gnosis_dbt: | ||
target: clickhouse | ||
target: ch-dbt | ||
outputs: | ||
clickhouse: # ClickHouse configuration for additional data sourcing | ||
ch-dbt: | ||
type: clickhouse | ||
schema: "{{ env_var('CLICKHOUSE_SCHEMA') }}" | ||
schema: "dbt" | ||
verify: False | ||
host: "{{ env_var('CLICKHOUSE_URL') }}" | ||
port: "{{ env_var('CLICKHOUSE_PORT', '8123') | int }}" | ||
secure: "{{ (env_var('CLICKHOUSE_SECURE', 'False') | lower) == 'true' }}" | ||
cluster: '{cluster}' | ||
cluster_mode: True | ||
user: "{{ env_var('CLICKHOUSE_USER') }}" | ||
password: "{{ env_var('CLICKHOUSE_PASSWORD') }}" | ||
threads: 40 | ||
connect_timeout: 60 # Increase the connect timeout (in seconds) | ||
read_timeout: 3000 # Increase the read timeout (in seconds) | ||
|
||
ch-valtrack: | ||
type: clickhouse | ||
schema: "valtrack_preview" | ||
verify: False | ||
host: "{{ env_var('CLICKHOUSE_URL') }}" | ||
port: "{{ env_var('CLICKHOUSE_PORT', '8123') | int }}" | ||
secure: "{{ (env_var('CLICKHOUSE_SECURE', 'False') | lower) == 'true' }}" | ||
user: "{{ env_var('CLICKHOUSE_USER') }}" | ||
password: "{{ env_var('CLICKHOUSE_PASSWORD') }}" | ||
threads: 40 | ||
connect_timeout: 60 | ||
read_timeout: 3000 | ||
|
||
ch-goteth: | ||
type: clickhouse | ||
schema: "goteth_preview" | ||
verify: False | ||
host: "{{ env_var('CLICKHOUSE_URL') }}" | ||
port: "{{ env_var('CLICKHOUSE_PORT', '8123') | int }}" | ||
secure: "{{ (env_var('CLICKHOUSE_SECURE', 'False') | lower) == 'true' }}" | ||
user: "{{ env_var('CLICKHOUSE_USER') }}" | ||
password: "{{ env_var('CLICKHOUSE_PASSWORD') }}" | ||
threads: 40 | ||
connect_timeout: 60 | ||
read_timeout: 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dbt-core==1.8.7 | ||
dbt-clickhouse==1.8.4 | ||
pytest==8.2.1 |