예제 #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)
예제 #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;""")
예제 #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""")
예제 #4
0
 def get_count():
     return DAL.get_count(
         """SELECT count(*) FROM data_source.collision_data_toronto""")
예제 #5
0
 def fetch_all():
     return DAL.fetch_all(
         """SELECT * FROM data_source.collision_data_toronto""")
예제 #6
0
 def get_count():
     return DAL.get_count("""SELECT count(*) FROM data_source.climate_data_toronto""")
예제 #7
0
 def fetch_all():
     return DAL.fetch_all("""SELECT * FROM data_source.climate_data_toronto""")
예제 #8
0
 def get_count():
     return DAL.get_count(
         """SELECT count(*) FROM data_source.climate_data_ottawa""")
예제 #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""")
예제 #11
0
 def get_count():
     return DAL.get_count(
         """SELECT count(*) FROM data_source.collision_data_ottawa""")
예제 #12
0
 def fetch_all():
     return DAL.fetch_all(
         """SELECT * FROM data_source.collision_data_ottawa""")