Commit 11b9a9af authored by Dorian's avatar Dorian

Changement Nom de table Q2

parent eabb1176
...@@ -37,7 +37,7 @@ def getStatisticsQ2(indicator, hour, day, month, year) : ...@@ -37,7 +37,7 @@ def getStatisticsQ2(indicator, hour, day, month, year) :
cluster = Cluster(['localhost']) cluster = Cluster(['localhost'])
session = cluster.connect('dbermond_projet') session = cluster.connect('dbermond_projet')
query = "SELECT " + indicator.lower() + " FROM weatherQ2 WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s " query = "SELECT " + indicator.lower() + " FROM weatherByTime WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s "
#print("Query = "+query) #print("Query = "+query)
results = session.execute(query, t) results = session.execute(query, t)
nQ2 = 0 nQ2 = 0
...@@ -124,7 +124,7 @@ def getPointsAndColor(indicator, hour, day, month, year, numberOfPoint, colorRan ...@@ -124,7 +124,7 @@ def getPointsAndColor(indicator, hour, day, month, year, numberOfPoint, colorRan
query = """ query = """
SELECT SELECT
""" + indicator.lower() + """, latitude, longitude """ + indicator.lower() + """, latitude, longitude
FROM weatherQ2 FROM weatherByTime
WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s
""" """
results = session.execute(query, t) results = session.execute(query, t)
...@@ -287,7 +287,7 @@ def computeQuantile(indicator, hour, day, month, year, numberOfQuantiles, theore ...@@ -287,7 +287,7 @@ def computeQuantile(indicator, hour, day, month, year, numberOfQuantiles, theore
) )
query = """ query = """
SELECT %s SELECT %s
FROM weatherQ2 FROM weatherByTime
WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s
""" """
nQ2 = 0 nQ2 = 0
...@@ -321,7 +321,7 @@ def getCumulativeDistributionFunctionQ2(indicator, hour, day, month, year, numbe ...@@ -321,7 +321,7 @@ def getCumulativeDistributionFunctionQ2(indicator, hour, day, month, year, numbe
query = """ query = """
SELECT %s SELECT %s
FROM weatherQ2 FROM weatherByTime
WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s WHERE DhmYear = %s AND DhmMonth = %s AND DhmDay = %s AND DhmHour = %s
""" """
results = session.execute(query, t) results = session.execute(query, t)
......
...@@ -124,25 +124,25 @@ def loadataQ2(filename): ...@@ -124,25 +124,25 @@ def loadataQ2(filename):
def initTableForQ2(session) : def initTableForQ2(session) :
query = ''' query = '''
DROP TABLE IF EXISTS weatherQ2 ; DROP TABLE IF EXISTS weatherByTime ;
''' '''
session.execute(query) session.execute(query)
query = ''' query = '''
CREATE TABLE weatherQ2( CREATE TABLE weatherByTime(
Station text, Station text,
DhmYear varint, DhmYear varint,
DhmMonth varint, DhmMonth varint,
DhmDay varint, DhmDay varint,
DhmHour varint, DhmHour varint,
DhmMinute varint, DhmMinute varint,
Longitude float, Longitude float,
Latitude float, Latitude float,
Temperature float, Temperature float,
DewPoint float, DewPoint float,
RelativeHumidity float, RelativeHumidity float,
...@@ -153,31 +153,31 @@ def initTableForQ2(session) : ...@@ -153,31 +153,31 @@ def initTableForQ2(session) :
-- mslp float, -- mslp float,
Visibility float, Visibility float,
-- gust float, -- gust float,
-- skyc1 text, -- skyc1 text,
-- skyc2 text, -- skyc2 text,
-- skyc3 text, -- skyc3 text,
-- skyc4 text, -- skyc4 text,
-- skyl1 float, -- skyl1 float,
-- skyl2 float, -- skyl2 float,
-- skyl3 float, -- skyl3 float,
-- skyl4 float, -- skyl4 float,
-- wxcodes text, -- wxcodes text,
-- ice_accretion_1hr float, -- ice_accretion_1hr float,
-- ice_accretion_3hr float, -- ice_accretion_3hr float,
-- ice_accretion_6hr float, -- ice_accretion_6hr float,
-- peak_wind_gust float, -- peak_wind_gust float,
-- peak_wind_drct float, -- peak_wind_drct float,
-- peak_wind_time float, -- peak_wind_time float,
ApparentTemperature float, ApparentTemperature float,
-- metar text, -- metar text,
PRIMARY KEY ((DhmYear, DhmMonth, DhmDay), DhmHour, DhmMinute, Latitude, Longitude) PRIMARY KEY ((DhmYear, DhmMonth, DhmDay), DhmHour, DhmMinute, Latitude, Longitude)
); );
''' '''
...@@ -238,19 +238,19 @@ def getWeatherQ2(csvfilename, limit): ...@@ -238,19 +238,19 @@ def getWeatherQ2(csvfilename, limit):
# r["metar"], # r["metar"],
) )
query = """ query = """
INSERT INTO weatherQ2( INSERT INTO weatherByTime(
Station, Station,
DhmYear, DhmYear,
DhmMonth, DhmMonth,
DhmDay, DhmDay,
DhmHour, DhmHour,
DhmMinute, DhmMinute,
Longitude, Longitude,
Latitude, Latitude,
Temperature, Temperature,
DewPoint, DewPoint,
RelativeHumidity, RelativeHumidity,
...@@ -261,30 +261,30 @@ def getWeatherQ2(csvfilename, limit): ...@@ -261,30 +261,30 @@ def getWeatherQ2(csvfilename, limit):
-- mslp float, -- mslp float,
Visibility, Visibility,
-- gust float, -- gust float,
-- skyc1 text, -- skyc1 text,
-- skyc2 text, -- skyc2 text,
-- skyc3 text, -- skyc3 text,
-- skyc4 text, -- skyc4 text,
-- skyl1 float, -- skyl1 float,
-- skyl2 float, -- skyl2 float,
-- skyl3 float, -- skyl3 float,
-- skyl4 float, -- skyl4 float,
-- wxcodes text, -- wxcodes text,
-- ice_accretion_1hr float, -- ice_accretion_1hr float,
-- ice_accretion_3hr float, -- ice_accretion_3hr float,
-- ice_accretion_6hr float, -- ice_accretion_6hr float,
-- peak_wind_gust float, -- peak_wind_gust float,
-- peak_wind_drct float, -- peak_wind_drct float,
-- peak_wind_time float, -- peak_wind_time float,
ApparentTemperature ApparentTemperature
-- metar -- metar
) )
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment