Skip to content

Batch mode #579

Description

@suhlig

Thanks for this project; very useful.

I would be interested in running this in batch mode; i.e. specifying the query on stdin or in a file. I could then make csv-sql part of shell pipelines and run it in continuous integration.

Something like this syntax comes to mind:

$ echo '.export(results.csv) SELECT COUNT(*) from t;' | csvsql file.csv

Alternatively, reading the query from a file would also be useful:

$ echo '.export(results.csv) SELECT COUNT(*) from t;' > query.sql
$ csvsql file.csv --load-query-from query.sql

If --load-query-from would accept - as a symbol for stdin, the line would look like this:

$ echo '.export(results.csv) SELECT COUNT(*) from t;' | csvsql file.csv --load-query-from -

Personally, the first option (read query from stdin if it's not a TTY) would be my preference.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions