Total Complexity | 3 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import functools |
||
2 | |||
3 | from egon.data import db |
||
4 | from egon.data.datasets import Dataset |
||
5 | |||
6 | |||
7 | def setup(): |
||
8 | """ Initialize the local database used for data processing. """ |
||
9 | engine = db.engine() |
||
10 | with engine.connect().execution_options(autocommit=True) as connection: |
||
11 | for extension in ["hstore", "postgis", "postgis_raster", "pgrouting"]: |
||
12 | connection.execute(f"CREATE EXTENSION IF NOT EXISTS {extension}") |
||
13 | |||
14 | |||
15 | Setup = functools.partial( |
||
16 | Dataset, |
||
17 | name="Database Setup", |
||
18 | version="0.0.0", |
||
19 | dependencies=[], |
||
20 | tasks=setup, |
||
21 | ) |
||
22 |