![]() ![]() e, -encoding TEXT Choose the input CSV's file encoding. x, -delimiter TEXT Choose the CSV delimiter. ![]() v, -verbose Determines whether progress reporting The first line full: read the entire file t, -typing Determines whether the script should guess o, -output PATH The output database path I have a situation where I have CSV files with column names in the first row, which perfectly match the tables in my SQLite3 db, except they are in a different order. Processed, including file names piped from f, -file PATH A file to copy into the database. Ls *.csv | % FullName | csv-to-sqlite -o out.db If file names are passed both via the -file option and standard input,įor example in PowerShell, if you want to copy all the csv files in theĬurrent folder into a database called "out.db", type: Taken from the headers (first row) in the csv file. Each file is copied into a separate table. The current list is: Usage: csv-to-sqlite Ī script that processes the input CSV files and copies them into a SQLiteĭatabase. Input_files = # pass in a list of CSV filesĬsv_to_sqlite.write_csv(input_files, "output.sqlite", options)Īs usual, if you want to see what you can do, call csv-to-sqlite -help. ![]() Options = csv_to_sqlite.CsvOptions(typing_style="full", encoding="windows-1250") If you wish to do that, simply install it as a dependency: pip install csv-to-sqlite As an aside: if you're not using Pipenv yet, take a look at it. There are a few new things, suggested in GitHub issues: you can now specify that you do not want brackets around your column names, you can specify the encoding your files (the default still is UTF-8) and it's now easier to use csv-to-sqlite in scripts. Version 2.1 of csv-to-sqlite was just released. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |