Skip to content

OEP Client Tutorial 04 - Upload data to the Open Energy Platform using the OEP Client in the command line#

OpenEnergy Platform

Learnings#

This tutorials will enable you to:

Requirements#

  • Python packages:

  • oep-client>=0.17 (installs also the command line tool)

  • Skills:

  • use the command line

Setup#

For the setup commands to work, you need to set your personal OEP API token as an environment variable. Alternatively, you can assign your token directly to the token variable. You can find the token on your OEP profile page.

  • Linux
token=$OEP_API_TOKEN
table=tutorial_example_table_$RANDOM
topic=sandbox
example_data=https://raw.githubusercontent.com/OpenEnergyPlatform/academy/production/docs/data/tutorial_example_table.data.csv
example_metadata=https://raw.githubusercontent.com/OpenEnergyPlatform/academy/production/docs/data/tutorial_example_table.metadata.json
  • Windows
SET token=%OEP_API_TOKEN%
SET table=tutorial_example_table_%RANDOM%
SET topic=sandbox
SET example_data=https://raw.githubusercontent.com/OpenEnergyPlatform/academy/production/docs/data/tutorial_example_table.data.csv
SET example_metadata=https://raw.githubusercontent.com/OpenEnergyPlatform/academy/production/docs/data/tutorial_example_table.metadata.json

Help#

Show available commands:

oep-client --help

Create table#

This part of the code creates the table you will later upload to the OEP.

We need the metadata to get the table schema (columns).

To be able to execute this part you will need to have executed the setup

  • Linux
  oep-client --token $token --schema $topic create $table $example_metadata
  • Windows
  oep-client --token %token% --schema %topic% create %table% %example_metadata%

Upload data#

This part of the code uploads the table that you have created above to the OEP.

To be able to execute this part you will need to have executed the setup and you will need to have created a table.

  • Linux
  oep-client --token $token --schema $topic insert $table $example_data
  • Windows
  oep-client --token %token% --schema %topic% insert %table% %example_data%

Upload metadata#

This part of the code will upload metadata that described the data in your table to the OEP.

To be able to execute this part you will need to have executed the setup and you will need to have created a table.

  • Linux
  oep-client --token $token --schema $topic metadata set $table $example_metadata
  • Windows
  oep-client --token %token% --schema %topic% metadata set %table% %example_metadata%

Delete table#

This part of the code deletes the table (including the metadata) that you have uploaded to the OEP.

To be able to execute this part you will need to have executed the setup and you will need to have created a table.

  • Linux
oep-client --token $token --schema $topic drop $table
  • Windows
oep-client --token %token% --schema %topic% drop %table%

About this tutorial#

logo

  • Author: Christian Winger
  • Copyright: Öko-Institut (2024)
  • License: CC BY 4.0
  • Attribution: Öko-Institut (2024): OEP Client Tutorial 04 - Upload data to the Open Energy Platform using the OEP Client in the command line
  • Last update: 2024-04-11