-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate v0 features to v1 API #70
Comments
Regarding seeding data from So, by default we got the following errors even though adjusting file path of CSV. % mysql --user=root --password=root --host=0.0.0.0 < sql/import.sql
ERROR 3948 (42000) at line 27: Loading local data is disabled; this must be enabled on both the client and server sides This is because MySQL have disabled to load data by default with param -- % mysql --user=root --password=root --host=0.0.0.0 --execute='select @@local_infile'
+----------------+
| @@local_infile |
+----------------+
| 0 |
+----------------+ So we need to fix this with updating defaults: # Update default parameters
% mysql --user=root --password=root --host=0.0.0.0 --execute='set persist local_infile = 1;'
% mysql --user=root --password=root --host=0.0.0.0 --execute='select @@local_infile'
+----------------+
| @@local_infile |
+----------------+
| 1 |
+----------------+
# Load data from CSV
% mysql --user=root --password=root --host=0.0.0.0 --local-infile=1 < sql/import.sql
# Validate
% mysql --user=root --password=root --host=0.0.0.0 --execute='select count(*) from rt.airport;'
+----------+
| count(*) |
+----------+
| 7698 |
+----------+
% mysql --user=root --password=root --host=0.0.0.0 --execute='select * from rt.airport limit 10;'
+----+---------------------------------------------+--------------+------------------+------+------+-----------+------------+----------+----------+------+----------------------+---------+-------------+--------+
| id | Name | City | Country | IATA | ICAO | Latitude | Longitude | Altitude | Timezone | DST | Tz database time | zone | Type | Source |
+----+---------------------------------------------+--------------+------------------+------+------+-----------+------------+----------+----------+------+----------------------+---------+-------------+--------+
| 1 | Goroka Airport | Goroka | Papua New Guinea | GKA | AYGA | -6.081690 | 145.391998 | 5282 | 10 | U | Pacific/Port_Moresby | airport | OurAirports | NULL |
| 2 | Madang Airport | Madang | Papua New Guinea | MAG | AYMD | -5.207080 | 145.789001 | 20 | 10 | U | Pacific/Port_Moresby | airport | OurAirports | NULL |
| 3 | Mount Hagen Kagamuga Airport | Mount Hagen | Papua New Guinea | HGU | AYMH | -5.826790 | 144.296005 | 5388 | 10 | U | Pacific/Port_Moresby | airport | OurAirports | NULL |
| 4 | Nadzab Airport | Nadzab | Papua New Guinea | LAE | AYNZ | -6.569803 | 146.725977 | 239 | 10 | U | Pacific/Port_Moresby | airport | OurAirports | NULL |
| 5 | Port Moresby Jacksons International Airport | Port Moresby | Papua New Guinea | POM | AYPY | -9.443380 | 147.220001 | 146 | 10 | U | Pacific/Port_Moresby | airport | OurAirports | NULL |
| 6 | Wewak International Airport | Wewak | Papua New Guinea | WWK | AYWK | -3.583830 | 143.669006 | 19 | 10 | U | Pacific/Port_Moresby | airport | OurAirports | NULL |
| 7 | Narsarsuaq Airport | Narssarssuaq | Greenland | UAK | BGBW | 61.160500 | -45.425999 | 112 | -3 | E | America/Godthab | airport | OurAirports | NULL |
| 8 | Godthaab / Nuuk Airport | Godthaab | Greenland | GOH | BGGH | 64.190903 | -51.678101 | 283 | -3 | E | America/Godthab | airport | OurAirports | NULL |
| 9 | Kangerlussuaq Airport | Sondrestrom | Greenland | SFJ | BGSF | 67.012222 | -50.711603 | 165 | -3 | E | America/Godthab | airport | OurAirports | NULL |
| 10 | Thule Air Base | Thule | Greenland | THU | BGTL | 76.531197 | -68.703201 | 251 | -4 | E | America/Thule | airport | OurAirports | NULL |
+----+---------------------------------------------+--------------+------------------+------+------+-----------+------------+----------+----------+------+----------------------+---------+-------------+--------+ |
Also, the raw seeds data of |
Also regarding FastAPI database model, FastAPI would basically expect to use with ORM like SQLAlchemy and its dialects for backend databases. mysql+mysqlconnector://<user>:<password>@<host>[:<port>]/<dbname> So we have to configure this in |
AsIs
With current code basis, we have 2 versions of API, v0 and v1, and some core logics are still implemented as back-porting API in v0 API.
This is not better way for future maintenance and code readability, so should be migrated within v1, which is current latest one.
ToDo
get_destination_from_skyscanner_by_random()
andget_near_airport()
seem to be depended on MySQL connection, we have to implement FastAPI database model first.app/api/v0/cruds.py
to v1 API, since all functions related to MySQL have been implemented in previous endpoint(Optional) Acceptance Criteria
The text was updated successfully, but these errors were encountered: