The purpose of this notebook is to show how to connect to the Smartenergi Datalake using python and ODBC driver. Before the below commands can be executed, one needs to make sure that the following requirements are fulfilled:

  • Make sure that ODBC package for python is installed. If not -> pip install pyodbc
  • Go to the following webpage and download ODBC driver for your operating system: https://docs.snowflake.com/en/user-guide/snowflake-client-repository.html
  • Follow the instructions to configure the ODBC driver for your operating system: https://docs.snowflake.com/en/user-guide/odbc.html Use following configuration parameters: Server: https://lq42418.eu-west-1.snowflakecomputing.com Database: SMARTENERGI_DATALAKE Schema: public Warehouse: COMPUTE_WH Role: public
  • Once done, use python script provided below to connect to Snowflake, provide username (smartenergi_public_user) and password (SmartEnergi2020!). There are two views in the database – metering_points_view and meter_readings_view that contains the data. Always use this command before executing any other queries – “cus.execute("use warehouse compute_wh;")”.
  • Following schemas are used: metering_points_view -> src: json, id: varchar(40), import_timestamp: datetime meter_readings_view -> src: json, metering_point_id: varchar(40), timestamp: datetime, property: varchar(30), import_timestamp: datetime
Loading output library...
Loading output library...