Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python-please help asap Hw2 has your first SQL from Python functions. So this discussion is to help make getting started easier. The first SQL function,
python-please help asap
Hw2 has your first SQL from Python functions. So this discussion is to help make getting started easier. The first SQL function, to_table, asks you to take the contents of a CSV file and use it to create a new table in a database. Here is some code for the first part of the function: def to_table (csv_fname, sql_fname, tbl_name="new1"): CSV_fp open (csv_fname, newline='') reader = csv.reader (csv_fp) conn sqlite3.connect (sql_fname) conn.row_factory sqlite3. Row conn.cursor() columns = next (reader) The function requires two queries to be executed. The second one will need to be created and then executed in a loop. Write and post code to create and execute these queries. In other words, this function is a class project. Do your best, but your code doesn't have to work. Only provide the query part, not the whole function! Just the query and the loop. Between what I have provided and your code, that will be most of the function, but anyone who posts their entire function will get no points. Hw2 has your first SQL from Python functions. So this discussion is to help make getting started easier. The first SQL function, to_table, asks you to take the contents of a CSV file and use it to create a new table in a database. Here is some code for the first part of the function: def to_table (csv_fname, sql_fname, tbl_name="new1"): CSV_fp open (csv_fname, newline='') reader = csv.reader (csv_fp) conn sqlite3.connect (sql_fname) conn.row_factory sqlite3. Row conn.cursor() columns = next (reader) The function requires two queries to be executed. The second one will need to be created and then executed in a loop. Write and post code to create and execute these queries. In other words, this function is a class project. Do your best, but your code doesn't have to work. Only provide the query part, not the whole function! Just the query and the loop. Between what I have provided and your code, that will be most of the function, but anyone who posts their entire function will get no pointsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started