Skip to content

Commit

Permalink
Merge pull request #2 from gnosischain/ch_pg_implementation
Browse files Browse the repository at this point in the history
Postgres implemented
  • Loading branch information
hdser authored Oct 17, 2024
2 parents c184321 + b206335 commit f32eae7
Show file tree
Hide file tree
Showing 34 changed files with 396 additions and 700 deletions.
7 changes: 6 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ CLICKHOUSE_URL
CLICKHOUSE_PORT
CLICKHOUSE_USER
CLICKHOUSE_PASSWORD
CLICKHOUSE_SECURE
CLICKHOUSE_SECURE

POSTGRES_URL
POSTGRES_PORT
POSTGRES_USER
POSTGRES_PASSWORD
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ RUN pip install --user -r /app/requirements.txt
# Copy dbt project
COPY dbt_project.yml /app/dbt_project.yml

# Copy profiles.yml to the .dbt directory in the user's home
COPY profiles.yml /home/appuser/.dbt/profiles.yml

# Copy macros, models and seeds
COPY /macros /app/macros
COPY /models /app/models
Expand All @@ -43,4 +46,4 @@ ENV DBT_PROJECT_PATH /app/src
EXPOSE 8080

# Set PATH to include user-level binaries
ENV PATH=/home/appuser/.local/bin:$PATH
ENV PATH=/home/appuser/.local/bin:$PATH
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ This dbt project is designed to facilitate the transformation and analysis of Gn
- `seeds/`: Seed files that contain static data used as inputs for models.


```
docker exec -it dbt /bin/bash
```


## Contributing
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'gnosis_dbt'
version: '1.0.0'
config-version: 2

profile: 'gnosis_dbt' # This should match the profile name in profiles.yml
profile: 'gnosis_dbt'

model-paths: ["models"]
analysis-paths: ["analyses"]
Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ services:
CLICKHOUSE_URL: ${CLICKHOUSE_URL}
CLICKHOUSE_PORT: ${CLICKHOUSE_PORT}
CLICKHOUSE_SECURE: ${CLICKHOUSE_SECURE}
POSTGRES_URL: ${POSTGRES_URL}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
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:
dbt_net:
30 changes: 0 additions & 30 deletions macros/consensus/_postgresql/create_bytea_to_bigint_function.sql

This file was deleted.

19 changes: 0 additions & 19 deletions macros/consensus/_postgresql/create_deserialize_eth2_function.sql

This file was deleted.

12 changes: 0 additions & 12 deletions macros/consensus/bytea_to_bigint.sql

This file was deleted.

30 changes: 0 additions & 30 deletions macros/consensus/deserialize_eth2.sql

This file was deleted.

70 changes: 0 additions & 70 deletions macros/consensus/node_count_over_time.sql

This file was deleted.

135 changes: 0 additions & 135 deletions macros/consensus/node_count_over_time_old.sql

This file was deleted.

17 changes: 17 additions & 0 deletions macros/db/clickhouse_utils.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% macro generate_schema_name(custom_schema_name, node) -%}
{%- set default_schema = target.schema -%}
{%- if custom_schema_name is none -%}
{{ default_schema }}
{%- else -%}
{{ custom_schema_name | trim }}
{%- endif -%}
{%- endmacro %}

{% macro generate_database_name(custom_database_name, node) -%}
{%- set default_database = target.schema -%}
{%- if custom_database_name is none -%}
{{ default_database }}
{%- else -%}
{{ custom_database_name | trim }}
{%- endif -%}
{%- endmacro %}
Loading

0 comments on commit f32eae7

Please sign in to comment.