Question: HyperionDev strives to provide internationally - excellent course content that helps achieve your learning outcomes. Think that the content of this task, or this course

HyperionDev strives to provide internationally-excellent course content that helps
achieve your learning outcomes.
Think that the content of this task, or this course as a whole, can be improved? Dc
think we've done a good job?
Click here to share your thoughts anonymously.Compulsory Task
Run SQLite and use .read create_database.sql to create a database called
HyperionDev.db.
Follow these steps by using
lookup.py as a template:
Create a program that allows a user to easily be able to make certain queries
in the database. When printing, only certain fields should show on console.
In addition, after each query, the user should be given the option to either
save the resulting query in XML or JSON form. The user should also be given
the option to choose their filename.
When saving to XML or JSON, all fields in the specified table should
be included in the file.
The user should be able to
View all subjects being taken by a specified student (search by
student_id).
On console, the subject name should only be shown
Look up an address given a first name and a surname.
Only the street name and city should be shown on the console.
List all reviews given to a student (search by student_id).
The completeness, efficiency, style and documentation scores
should be displayed on console, along with the review text.
List all courses being given by a specific teacher (search by
teacher_id).
Just the course name should be displayed on the console.
List all students who haven't completed their course.
The student number, first and last names, email addresses and
course names should be shown on the console.
List all students who have completed their course and achieved a
mark of 30 or below.
The student number, first and last names, email addresses and
course names should be shown on the console. Their marks
should also be displayed
Loopkup.py template:
import sqlite3
try:
conn = sqlite3.connect("HyperionDev.db")
except sqlite3.Error:
print("Please store your datebase as HyperionDev.db")
quit()
cur = connect.consor()
def usage_is)incorrect(input, num_args):
if len(input)!= num_args +1:
print(f"The {input[0]} commands required {num_args} argument.")
return True
return False
def store_data_as_json(data, filename):
pass
def store_data_as_xml(data, filename):
pass
def offer_to_store(data):
while True:
print("Would you like to store this result?")
choice = input("Y/[N]? : ").strip().lower()
if choice =="y":
filename = input ("Specify filename. Must end in .xml or .json")
ext = filename.split(".")[-1]
if ext =='xml':
store_data_as_xml(data, filename)
elif ext == 'json':
store_data_as_json(data, filename)
else:
print("Invalid file extension. Please use .xml or .json")
elif choice =='n':
break
else:
print("Invalid choice")
usage ='''
what would you like to do?
d - demo
vs
la
lr
lc
lnc
lf
e
Type your option here: '''
print("Welcome to the data querying app!")
while True:
print()
#Get input from user
user_input = input(usgausagee).split("")
print()
#Parse user input into command and args
command = user_input[0]
if len(user_input)>1:
args = user_input[1:]
if command =='d':
data = cur.execute("SELECT * FROM Student")
for _, firstname, surname, _,_ in data:
print("f{firstname}{surname}")
elif command =='vs':
if usage_is_incorrect(user_input, 1):
continue
student_id = atgs[0]
data = None
#Run SQL query and store in data
offer_to_store(data)
pass
elif command =='la': #list address by name and surname
if usage_is_incorrect(user_input, 1):
continue
student_id = args[0]
data = None
#Run SQL query and store in data
offer_to_store(data)
elif command =='lnc': #list all students who haven't completed their course
data = None
#Run SQL query and store in data
offer_to_store(data)
pass
elif command =='lf': #list all students who have completed their and got a mark =30
data = None
offer_to_store(data)
pass
elif command =='e' #list address by name and surname
print("Programme exited successfully!")
break
else:
print(f"Incorrect command: '{command}'")
 HyperionDev strives to provide internationally-excellent course content that helps achieve your

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!