Skip to content

Commit

Permalink
Merge pull request #385 from Open-Earth-Foundation/stationary_energy_…
Browse files Browse the repository at this point in the history
…mendoza

Stationary energy mendoza
  • Loading branch information
mfonsecaOEF authored Mar 19, 2024
2 parents 8850533 + 4a40372 commit c5e4acd
Show file tree
Hide file tree
Showing 4 changed files with 1,551 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ CREATE TEMP TABLE IF NOT EXISTS mendoza_stationary_energy_staging (LIKE citywide
TRUNCATE mendoza_stationary_energy_staging;

-- Load the staging table from the downloaded file
COPY mendoza_stationary_energy_staging (year, activity_name, activity_value, activity_units, "GPC_refno", gas_name, emission_factor_value, emission_factor_units, emissions_value, emissions_units, city_name, source_name, temporal_granularity, locode, id)

-- FROM '/opt/airflow/data/stationary_energy_mendoza.csv';
FROM :file_path DELIMITER ';' CSV HEADER;
\copy mendoza_stationary_energy_staging (year, activity_name, activity_value, activity_units, "GPC_refno", gas_name, emission_factor_value, emission_factor_units, emissions_value, emissions_units, city_name, source_name, temporal_granularity, locode, id) FROM './importer/mendoza_arg/stationary_energy_mendoza.csv' WITH (FORMAT CSV, HEADER);

-- Update the main table with the staging table
INSERT INTO citywide_emissions (year, activity_name, activity_value, activity_units, "GPC_refno", gas_name, emission_factor_value, emission_factor_units, emissions_value, emissions_units, city_name, source_name, temporal_granularity, locode, id)
Expand Down
2 changes: 1 addition & 1 deletion global-api/importer/mendoza_arg/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python ./importer/mendoza_arg/transformation_mendoza_stationary_energy.py --file
```
3. Extract the activity row from the source:
```bash
psql -U ccglobal -d ccglobal -f ./importer/mendoza_arg/load_mendoza_stationary_energy.py -v file_path=[path where the transformed data was saved]
psql -U ccglobal -d ccglobal -f ./importer/mendoza_arg/load_mendoza_stationary_energy.sql
```

### Directory tree
Expand Down
Loading

0 comments on commit c5e4acd

Please sign in to comment.