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 internationallyexcellent 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 createdatabase.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
studentid
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 studentid
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
teacherid
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 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 sqlite
try:
conn sqliteconnectHyperionDevdb
except sqliteError:
printPlease store your datebase as HyperionDev.db
quit
cur connect.consor
def usageisincorrectinput numargs:
if leninput numargs :
printfThe input commands required numargs argument."
return True
return False
def storedataasjsondata filename:
pass
def storedataasxmldata filename:
pass
def offertostoredata:
while True:
printWould you like to store this result?"
choice inputYN : striplower
if choice y:
filename input Specify filename. Must end in xml or json"
ext filename.split
if ext xml:
storedataasxmldata filename
elif ext 'json':
storedataasjsondata filename
else:
printInvalid file extension. Please use xml or json"
elif choice n:
break
else:
printInvalid choice"
usage
what would you like to do
d demo
vs
la
lr
lc
lnc
lf
e
Type your option here:
printWelcome to the data querying app!"
while True:
print
#Get input from user
userinput inputusgausageesplit
print
#Parse user input into command and args
command userinput
if lenuserinput:
args userinput:
if command d:
data cur.executeSELECT FROM Student"
for firstname, surname, in data:
printffirstnamesurname
elif command vs:
if usageisincorrectuserinput, :
continue
studentid atgs
data None
#Run SQL query and store in data
offertostoredata
pass
elif command la: #list address by name and surname
if usageisincorrectuserinput, :
continue
studentid args
data None
#Run SQL query and store in data
offertostoredata
elif command lnc: #list all students who haven't completed their course
data None
#Run SQL query and store in data
offertostoredata
pass
elif command lf: #list all students who have completed their and got a mark
data None
offertostoredata
pass
elif command e #list address by name and surname
printProgramme exited successfully!"
break
else:
printfIncorrect command: command
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
