sqlite-utils insert: options for column types
See original GitHub issueThe insert
command currently results in string types for every column - at least when used against CSV or TSV inputs.
It would be useful if you could do the following:
- automatically detects the column types based on eg the first 1000 records
- explicitly state the rule for specific columns
--detect-types
could work for the former - or it could do that by default and allow opt-out using --no-detect-types
For specific columns maybe this:
sqlite-utils insert db.db images images.tsv \
--tsv \
-c id int \
-c score float
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
sqlite_utils Python library - sqlite-utils - Datasette
Using this factory function allows you to set Table configuration options. ... Each column is paired with a Python type indicating the type...
Read more >sqlite-utils(1) - Debian Manpages
The SQLite ALTER TABLE statement is limited. It can add and drop columns and rename tables, but it cannot change column types, change...
Read more >What's new in sqlite-utils 3.20 and 3.21: --lines, --text, --convert
The sqlite-utils insert command inserts rows into a SQLite database from a JSON, CSV or TSV file, creating a table with the necessary...
Read more >Command Line Shell For SQLite
Type in SQL statements (terminated by a semicolon), press "Enter" and the SQL ... The "--wrap N" option (where N is an integer)...
Read more >Golang SQLite database/sql - Earthly Blog
SQLite, Data Types, and database/sql. You may notice that I'm storing time as DATETIME whereas sqlite-utils suggested TEXT for that column.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If
-c
isn’t available, maybe-t
or--type
would work for specifying column types:or
Just ran into this issue last night. I have a big table that’s mostly numbers, but also a zip code column in a state where ZIP codes start with 0. Would be great to run something like this:
Maybe I’ll take a crack at this one.