Question: Show me the steps to solve in python: Make a program to extract SQL data into JSON object or vise versa based on user's selection.
Show me the steps to solve in python:
Make a program to extract SQL data into JSON object or vise versa based on user's selection. Also, user will be allowed to enter custom SQL in from the prompt.
You will need to use the same data.JSON
The example output is below, you can structure your code however you want.
Example Outputs:
Load JSON data into Database
Export Database to JSON object
Custom SQL Command
Print All data in Database
Q quit
You selected to load data into JSON. Check for JSON file extension and if file exist, you can always assume user will pass file format
Please enter JSON file name: data.txt
Unfortunately, txt format is not supported, only JSON format.
Please enter JSON file name: dataJSON
File dataJSON was not found. Please make sure you didn't misspell file name.
Please enter JSON file name: data.JSON
File Found, data.JSON has objects. Loading into database.
Load JSON data into Database
Export Database to JSON object
Custom SQL Command
Print All data in Database
Q quit
Exporting all data to JSON object.
Please enter the name for the export file: Do not allow saving any format except JSON
example.txt
Unfortunately txt is not supported format, only JSON.
example.JSON
File is created and ready for use.
Load JSON data into Database
Export Database to JSON object
Custom SQL Command
Print All data in Database
Q quit
Please enter your custom SQL there is only one table named Users, and here is the list of columns: Do not allow anything but Select
ID Name, Age, City, State and PhoneNumber This part is up to you, whatever you named your columns print it here
Delete from Users
Sorry Delete is not allowed, only Select.
Select from User
Sorry something went wrong if any error occurs you can just say 'something went wrong'
Select from Users
User ID:
Alex Anderson
Omaha, NE
User ID:
Seth Green
Denver, CO
Do you wish to continue Y or back to main menu Bif sql was valid, ask user this question, user can enter lower or upper case doesn't matter, account for that
B
Load JSON data into Database
Export Database to JSON object
Custom SQL Command
Print All data in Database
Q quit
Q
Terminating Program, Good Bye!
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
