💡 本文同步發表於 Medium:原文連結
https://medium.com/@simon3458/transfer-the-csv-files-into-an-sqlite-database-ac4334ae5d54
點擊查看連結詳情...
Transfer the CSV Files into an SQLite Database

Title: Transfer the CSV Files into an SQLite Database
Datasets are readily available as CSV files on websites such as Kaggle and other real-world datasets. However, CSV isn’t really suitable for querying and transforming easily. Therefore, it’s better to store the data in a database.
In this article, you will use csvs-to-sqlite to convert CSV files into SQLite databases. Once the data is in a database, it’s easier for users to query with SQL and add to their ETL service.
CPBL is a famous sports league in Taiwan. We can get the history data of CPBL baseball players on the website. Some baseball fans tried to crawl the official data, store it in lots of CSV files and put them into Github. Then we can get the data in CSV files. In today's showcase, we will use the Github project as our example to transfer the files into the database.
Convert CSV to SQLite
GitHub - ldkrsi/cpbl-opendata: 從中職官網上爬資料並進行勘誤
從中職官網上爬資料並進行勘誤. Contribute to ldkrsi/cpbl-opendata development by creating an account on GitHub.
"csvs-to-sqlite" tool is an open-source project and put it in the Github. We can easily use the pip install method to install the tools.
GitHub - simonw/csvs-to-sqlite: Convert CSV files into a SQLite database
Convert CSV files into a SQLite database. Contribute to simonw/csvs-to-sqlite development by creating an account on GitHub.
Use the following commands to download the data and install the python package.
After configuring the environment, we can convert the CSV files into several SQLite databases.
The format of the csvs-to-sqlite command is:
csvs-to-sqlite /path/to/your.csv sqlite-db-name.db

The result after we convert the CSV files into a database
Verify the CSV was imported correctly
We can now check if the data was successfully inserted into the SQLite database using the “sqlite3” command line tool to open the database and query the data.
We have successfully queried the SQLite data, which is the same as the CSV data. Now, If a data engineer wanted to query the historical data of an individual baseball player, they could use SQL to query the data faster.

The result of querying data from the SQLite database
Add data reliability to your data pipeline
PipeRider, the new data quality toolkit for data professionals by InfuseAI, supports SQLite databases. You can quickly and easily add data profiling and data assertions to your project and view results in a convenient HTML report.
Prediksi Sdy : Pusatnya 🚀 Bocoran Sdy Terjitu, Paito Sdy Dan Syair Sdy Hari Ini.
Dapatkan informasi terjitu Prediksi sdy , bocoran sdy terjitu, update Paito sdy terbaru dan kode syair sdy hari ini secara gratis dan terpercaya.

I am Simon
Hi, I am Simon, Customer Success Engineer in InfuseAI. If you think the article is helpful to you, please give me applause. Welcome to provide some suggestions and discuss with me in InfuseAI Discord.
Linkedin: <https://www.linkedin.com/in/simonliuyuwei/>
We are InfuseAI
InfuseAI provides MLOps tools:
- PrimeHub— Our end-to-end MLOps platform, is the entire machine learning lifecycle in one platform.
- Piperider— The data quality toolkit for data professionals.
Join our machine learning community to discover more: InfuseAI Discord

這篇文章有幫上忙嗎?