How To Put CSV Data Into An SQLite DB With Python

Publié le: 11 septembre 2022
sur la chaîne: Make That Work
1,116
13

Storing data in flat files can be OK. But for a lot of applications you really need a database.

Python provides a neat little database out of the box called SQLite.

This video goes through a simple script that puts spreadsheet data into one of these SQLite databases.

First, we import our spreadsheet data (in CSV format) using Pandas. From that Pandas data frame we prepare the data ready for injection into our SQL database.

Then, the script establishes a connection to the database (creating it if it doesn't exist), and creates a cursor object. The cursor is the thing that allows us to work with the database (reading, writing and deleting data).

After that, all that remains is to actually inject the data into our database and we are done!

As a final step, we check to see it has worked by using a database browser (DB Browser) to view the contents of our database.

SQLite Python docs: https://docs.python.org/3/library/sql...
SQL cheat sheet: https://www.sqlitetutorial.net/sqlite...
DB Browser for SQLite: https://sqlitebrowser.org/
Article breaking down databases and spreadsheets: https://365datascience.com/tutorials/...


Sur cette page du site, vous pouvez voir la vidéo en ligne How To Put CSV Data Into An SQLite DB With Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Make That Work 11 septembre 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,116 fois et il a aimé 13 téléspectateurs. Bon visionnage!