def create(self, booking: Booking): cursor = self.db.cursor() sql = "INSERT INTO bookings(flight_id, passenger_id, flight_class, date, booking_ref, seat_number) VALUES ( %s, %s, %s, %s, %s, %s)" val = (booking.flight_id, booking.passenger_id, booking.flight_class, booking.date, booking.booking_ref, booking.seat_number) cursor.execute(sql, val) self.db.commit() booking.id = cursor.lastrowid
def create(self, booking: Booking): cursor = self.db.cursor() sql = "INSERT INTO bookings(passenger_id, flight_id, booking_type, flight_class, booking_no, booking_date, seat_no) " \ "VALUES(%s, %s, %s, %s, %s, %s, %s) " val = (booking.passenger_id, booking.flight_id, booking.booking_type, booking.flight_class, booking.booking_no, booking.booking_date, booking.seat_no) cursor.execute(sql, val) self.db.commit() booking.id = cursor.lastrowid