Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: insert-files mechanism for adding extra columns with fixed values #140

Open
simonw opened this issue Aug 28, 2020 · 1 comment
Open

Comments

@simonw
Copy link
Owner

simonw commented Aug 28, 2020

Say for example you want to populate a file_type column with the value gif. That could work like this:

sqlite-utils insert-files gifs.db images *.gif \
    -c path -c md5 -c last_modified:mtime \
    -c file_type:text:gif --pk=path

So a column defined as a text column with a value that follows a second colon.

@simonw
Copy link
Owner Author

simonw commented Mar 20, 2022

Alternative idea for specifying types: accept a Python expression, then use Python type literal syntax. For example:

sqlite-utils insert-files gifs.db images *.gif \
    -c path -c md5 -c last_modified:mtime \
    -a file_type '"gif"'

Where -a indicates an additional column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant