Ejemplo n.º 1
0
    def get_distinct_locations_and_time_information():
        sql = """
                    SELECT
                      AL.location_key, L.city, L.latitude, L.longitude, H.date, H.hour_start
                    
                    FROM
                      relations.accident_hour_relation AH,
                      relations.accident_location_relation AL,
                      relations.weather_hour_relation WH,
                      dimension_pre_stage.location_dimension_pre_stage L,
                      dimension_pre_stage.hour_dimension_pre_stage H
                    
                    WHERE
                      AH.accident_key = AL.accident_key
                      AND AH.hour_key = WH.hour_key
                      AND AL.location_key = L.location_key
                      AND AH.hour_key = H.hour_key
                    
                    GROUP BY
                      AL.location_key, L.city, L.latitude, L.longitude, H.date, H.hour_start
              """

        return DAL.fetch_all(sql)
Ejemplo n.º 2
0
 def get_locations_count():
     return DAL.get_count("""
                  SELECT COUNT(*) FROM (SELECT DISTINCT ON (longitude, latitude) *
                  FROM data_source.collision_data_toronto
                  GROUP BY id, longitude, latitude) a;""")
Ejemplo n.º 3
0
 def fetch_all_unique_locations():
     return DAL.fetch_all("""
                  SELECT DISTINCT ON (longitude, latitude) *
                  FROM data_source.collision_data_toronto
                  GROUP BY id, longitude, latitude""")
Ejemplo n.º 4
0
 def get_count():
     return DAL.get_count(
         """SELECT count(*) FROM data_source.collision_data_toronto""")
Ejemplo n.º 5
0
 def fetch_all():
     return DAL.fetch_all(
         """SELECT * FROM data_source.collision_data_toronto""")
Ejemplo n.º 6
0
 def get_count():
     return DAL.get_count("""SELECT count(*) FROM data_source.climate_data_toronto""")
Ejemplo n.º 7
0
 def fetch_all():
     return DAL.fetch_all("""SELECT * FROM data_source.climate_data_toronto""")
Ejemplo n.º 8
0
 def get_count():
     return DAL.get_count(
         """SELECT count(*) FROM data_source.climate_data_ottawa""")
Ejemplo n.º 9
0
 def fetch_all():
     return DAL.fetch_all(
         """SELECT * FROM data_source.climate_data_ottawa""")
 def fetch_all():
     return DAL.fetch_all("""SELECT * FROM data_source.station_inventory""")
Ejemplo n.º 11
0
 def get_count():
     return DAL.get_count(
         """SELECT count(*) FROM data_source.collision_data_ottawa""")
Ejemplo n.º 12
0
 def fetch_all():
     return DAL.fetch_all(
         """SELECT * FROM data_source.collision_data_ottawa""")