Station2Sql

This module contains all functions and classes for reading a station file in CSS3.0 format and pushing it into the database

Functions and Classes

closeStationInDB(station_id, off_date, db_conn=None)

Function for closing a station in the database. If the station doesn’t exist or it has already been closed the function will do nothing

Parameters:
  • station_id (int) – id of the station in the database
  • off_date (datetime) – the new off_date of the station
getNetworkID(network, privacy_level)

Function for inserting the information to the database. If network doesn’t already exist, the function adds the network to the database.

Parameters:station (array) – Array of all station related information in their correct spaces
Returns:network id inserted to the database
getNetworkOfStation(station, privacy_level='public')

Function for getting the network related to given station.

Parameters:Station (station) – station that should be used in the search
insertStation2Database(station, network, privacy_level='public')

Function for inserting the station to the database. If a station with the given code already exists the function will raise an error.

Parameters:
  • Station (station) – station that will be inserted to the database
  • str (privacy_level) – network to which this station belongs to
  • str – The privacy level of the network if it is going to be a new one
updateNetworkOfStation(station, desired_network, privacy_level='public')

Function for updating the network related to given station.

Parameters:Station (station) – station that should be used in the search