Question: 9 . 8 LAB - Database programming with Python LAB 9 . 8 . 1 : LAB - Database programming with Python Complete the Python
LAB Database programming with Python
LAB
: LAB Database programming with Python
Complete the Python program to create a Horse table, insert one row, and print the row.
Implement the following functions. Function parameters are described in the template. Do not modify the main program. createconnection creates a connection to the database. This function calls mysql connector. connect with three arguments:
user'root'
host
database'zybooksdb'
The password argument is not necessary and can be omitted.
createtable creates Horse, with five columns:
ID integer, primary key
Name varchar
Breed varchar
Heightdouble
BirthDate varchar
Before creating Horse, drop the table if the table exists from a prior run
inserthorse inserts one row into Horse:
'Babe', 'Quarter horse',
selectallhorses selects and prints all Horse rows, as follows:
All horses:
'Babe', 'Quarter Horse',
Latest submission : PM EST on
Only show failing tests
Open submission's code
: Unit test all functions
Test createconnection createtable and insertrow functions
Test createconnection createtable and insertrow functions
binitpy line in importmodule
return bootstrap.gcdimportnamelevel: package, level
File line in gcdimport
File line in findandload
File line in findandloadunlocked
File line in loadunlocked
File line in execmodule
File line in callwithframesremoved
File usercodecodingroomsunittests.py line ; in
import main
File usercodemainpy line in
cexecute
sqliteOperationalError: table stocks already exists
: Compare output
Compare program output to expected output
Traceback most recent call last:
File usercodemainpy line in
cexecute
sqliteOperationalError: table stocks already exists
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
