Skip to content

Commit

Permalink
switched from mongoDB to Postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
esalonico committed Jun 21, 2023
1 parent d6a24ec commit 519ae6e
Show file tree
Hide file tree
Showing 7 changed files with 635 additions and 213 deletions.
11 changes: 7 additions & 4 deletions config.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[routes]
; Format: [origin, destination, range_of_days_from_today]

muc_fco = ["MUC", "FCO", 60]
fco_muc = ["FCO", "MUC", 60]
fmm_fco = ["FMM", "FCO", 60]
fco_fmm = ["FCO", "FMM", 60]
muc_fco = ["MUC", "FCO", 3]
fco_muc = ["FCO", "MUC", 3]

; muc_fco = ["MUC", "FCO", 60]
; fco_muc = ["FCO", "MUC", 60]
; fmm_fco = ["FMM", "FCO", 60]
; fco_fmm = ["FCO", "FMM", 60]
14 changes: 11 additions & 3 deletions flight_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ def get_routes():

# TODO: implement push to database after every route (error handling basically)

# 2. add results to mongo_db
database = Database(private.DB_URL, private.DB_NAME, private.DB_COLL)
database.add_pandas_df(all_results_df)
# 2. add results to postgresql

# connect to database
db = Database(db_host=private.DB_HOST, db_name=private.DB_NAME, db_user=private.DB_USER, db_pw=private.DB_PW, db_table=private.DB_TABLE)
print(db.list_all_databases())

# prepare database and tables
db.prepare_db_and_tables(overwrite_table=True)

# add results to database
db.add_pandas_df_to_db(all_results_df)

Loading

0 comments on commit 519ae6e

Please sign in to comment.