Skip to content

Commit

Permalink
Resolved #414.
Browse files Browse the repository at this point in the history
  • Loading branch information
j3-signalroom committed Oct 28, 2024
1 parent 72ef856 commit 9ae81e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/src/kickstarter/flink_kickstarter_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ def load_data(_tbl_env: StreamTableEnvironment, database_name: str) -> Tuple[pd.
Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]: is a tuple of Pandas DataFrames.
"""
# Get the number of flights per month by airline, year, and month
airline_monthly_flights_table = _tbl_env.sql_query("""
airline_monthly_flights_table = _tbl_env.sql_query(f"""
select
airline,
extract(year from to_timestamp(departure_time)) as departure_year,
extract(month from to_timestamp(departure_time)) as departure_month,
concat(date_format(to_timestamp(departure_time), 'MM'), '-', date_format(to_timestamp(departure_time), 'MMM')) as departure_month_abbr,
count(*) as flight_count
from
airlines.flight
{database_name}.flight
group by
airline,
extract(year from to_timestamp(departure_time)),
Expand All @@ -53,7 +53,7 @@ def load_data(_tbl_env: StreamTableEnvironment, database_name: str) -> Tuple[pd.
df_airline_monthly_flights_table = airline_monthly_flights_table.to_pandas()

# Get the top airports with the most departures by airport, airline, year, and rank
ranked_airports_table = _tbl_env.sql_query("""
ranked_airports_table = _tbl_env.sql_query(f"""
with cte_ranked as (
select
airline,
Expand All @@ -68,7 +68,7 @@ def load_data(_tbl_env: StreamTableEnvironment, database_name: str) -> Tuple[pd.
departure_airport_code,
count(*) as flight_count
from
airlines.flight
{database_name}.flight
group by
airline,
extract(year from to_timestamp(departure_time)),
Expand Down

0 comments on commit 9ae81e4

Please sign in to comment.