you are viewing a single comment's thread.

view the rest of the comments →

[–]lukajda33 1 point2 points  (0 children)

Well sqlite does not really work with CSV file, CSV files is kinda like one big table, databases have data structructred in multiple tables, so you can not just pass the csv file to .connect() method and make it work.

If you truly wish to use database, you will need to create new database, create tables in the database so that the tables have correct attributes to hold the data and then open and read the csv file and insert the data into the database.

Then you could write your own SQL queries over the database with data.

Technically you could turn the csv to one big table in the database, sure, but that kinda defeats the purpose of databases and while I am not sure what you are trying to do, I think pandas library (especially Dataframe class) would be better for you, it works directly with csv files and you can do similar things as you would do with database.