Hi,
First off, I'm a real greenhorn so please forgive me asking questions which may be bleeding obvious, but I have searched and searched and cannot find an answer to my problem.
I'm trying to import a CSV file into sqlite3 database in python. The CSV file has 56 columns though. Is there any way to create the sqlite table columns without having to manually describe each column
eg con.execute("CREATE TABLE IF NOT EXISTS QUESTIONS (col1, col2.... )")
I imagine there must by a simple way of taking the first row of the csv file and using those comma-seperated values to define the columns of the table. Please tell me I don't have to manually define all 56 table columns!!!
In my searching I have found methods for assigning the values of the first row to describe table columns but not creating the columns and naming them at the same time.
Also, if such a method exists can it handle column descriptors which are strings ie defined within ""s? (A number of these column names are longish sentences)
andrewtrench 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.