Boost your Grades with us today!

assignment help b10932

I’m writing an API in Flask which loads queries saved in files to execute them. The query executed depends on the input format. However, all the queries are the same except they may have 1 of these 4 snippets:

————————————————–

SELECT * FROM shipments

WHERE origin = %(origin)s

AND destination = %(destination)s

————————————————–

SELECT * FROM shipments

WHERE origin = %(origin)s

AND destination IN %(destination)s

————————————————–

SELECT * FROM shipments

WHERE origin IN %(origin)s

AND destination = %(destination)s

————————————————–

SELECT * FROM shipments

WHERE origin IN %(origin)s

AND destination IN %(destination)s

————————————————–

Is there a better way to save & modify a single SQL query based on the input format, rather than having 4 slightly different copies?

I’m unsure if this is even desirable since they are 4 different queries, but I was wondering if there’s a way to parameterize the query itself like:

————————————————–

SELECT * FROM shipments

WHERE origin %(origin_format)q %(origin)s

AND destination %(destination_format)q %(destination)s

————————————————–

Where %(origin_format)q and %(destination_format)q would be IN or =

Solution:

15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.