Allow passing a file of code to "sqlite-utils convert"
See original GitHub issuesqlite-utils is so nice, but the ergonomics of the multiline code in kind of tough. It’s really hard (maybe impossible) to make the newlines play well with Makefiles.
it would be great to write your code fragment in a separate file and direct it into the sqlite-utils
either like
sqlite-utils convert my.db my_table my_column < custom_code.py
or
sqlite-utils convert my.db my_table my_column --custom-code=custom_code.py
Thanks, as ever, for these great tools!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
sqlite-utils command-line tool
The --convert option can be used to apply a Python conversion function to imported data before it is inserted into the database. It...
Read more >sqlite-utils command-line tool - Datasette
The sqlite-utils memory command works similar to sqlite-utils query , but allows you to execute queries against an in-memory database.
Read more >CLI reference - sqlite-utils
Your Python code will be passed a "row" variable representing the imported row, and can return a modified row. This example uses just...
Read more >sqlite_utils Python library - sqlite-utils - Datasette
Database objects are constructed by passing in either a path to a file on disk or an existing SQLite3 database connection: from sqlite_utils...
Read more >sqlite-utils documentation
You can pass multiple files to the command if you want to run joins ... can be used in the code passed to...
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
One option: allow
CODE
to be a special value of-
which means “read from standard input”. It’s a tiny bit of a hack but I think it would work here.If you wanted to replace a column entirely with hyphens you would still be able to do this:
wow! that’s awesome! thanks so much, @simonw!