diff --git a/etl/etl_routemodel/etl_routemodel.py b/etl/etl_routemodel/etl_routemodel.py index 291e0e8..46bc48f 100644 --- a/etl/etl_routemodel/etl_routemodel.py +++ b/etl/etl_routemodel/etl_routemodel.py @@ -71,7 +71,9 @@ def seed_from_csv(csv_filepath, db_user, db_password, db_host, db_name): df.index += 1 # Making table 1-indexed if inspect(engine).has_table("routemodel"): - row_len = pd.read_sql_query(sql="SELECT COUNT(*) FROM routemodel", con=engine) + row_len = pd.read_sql_query( + sql="SELECT COUNT(*) FROM routemodel ORDER BY id ASC", con=engine + ) df.index += row_len.iloc[0, 0] response = df.to_sql( diff --git a/etl/etl_weather/etl_weather.py b/etl/etl_weather/etl_weather.py index f1262b0..99d9e0c 100644 --- a/etl/etl_weather/etl_weather.py +++ b/etl/etl_weather/etl_weather.py @@ -48,7 +48,9 @@ def get_routemodel_df(db_user, db_password, db_host, db_name): if not inspect(engine).has_table("routemodel"): raise SystemError("routemodel table does not exist in database") - routemodel_df = pd.read_sql_query(sql="SELECT * FROM routemodel", con=engine) + routemodel_df = pd.read_sql_query( + sql="SELECT * FROM routemodel ORDER BY id ASC", con=engine + ) return routemodel_df diff --git a/update_weather_service/update_weather.py b/update_weather_service/update_weather.py index 76e84d2..6ac78cb 100644 --- a/update_weather_service/update_weather.py +++ b/update_weather_service/update_weather.py @@ -45,7 +45,9 @@ def update_weather(db_user, db_password, db_host, db_name, API_KEY, weather_row_ if not inspect(engine).has_table("weather"): raise SystemError("weather table does not exist in database") - weather_df = pd.read_sql_query(sql="SELECT * FROM weather", con=engine) + weather_df = pd.read_sql_query( + sql="SELECT * FROM weather ORDER BY id ASC", con=engine + ) weather_df.index += 1 # Make it 1-indexed weather_df_len = len(weather_df) + 1