Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

of the function is missing. return jsonify(results) @app.route(/api/v1.o/passengers) def passengers(): Return a list of passenger data including the name, age, and sex of each passenger

image text in transcribedimage text in transcribed

of the function is missing. return jsonify(results) @app.route("/api/v1.o/passengers") def passengers(): ""Return a list of passenger data including the name, age, and sex of each passenger" " \# Query all passengers session = Session(engine) results = session.query(Passenger.name, Passenger.age, Passenger.sex).all() \# Create a dictionary from the row data and append to a list of all_passengers all_passengers = [] for name, age, sex in results: passenger_dict = \{\} passenger_dict["name"] = name passenger_dict["age"] = age passenger_dict["sex"] = sex all_passengers.append(passenger_dict) \#\#\# Return list of all passenger data in Json format \#\#\# if name == '_main_: app.run(debug=True) On line 52, what line of code needs to be inserted so that the list of all passenger data will be sent to the end-point in JSON format? return all_passengers.json() return json(all_passengers) return jsonify(all_passengers) return all_passengers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

=+3. Describe two types of treatment for PTSD.

Answered: 1 week ago

Question

Persuasive Speaking Organizing Patterns in Persuasive Speaking?

Answered: 1 week ago