Answered step by step
Verified Expert Solution
Link Copied!

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,

image text in transcribedpython-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 points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

Students also viewed these Databases questions

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago