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

--sql and --attach options for feeding commands from SQL queries #8

Closed
3 tasks done
simonw opened this issue Sep 8, 2019 · 4 comments
Closed
3 tasks done

--sql and --attach options for feeding commands from SQL queries #8

simonw opened this issue Sep 8, 2019 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@simonw
Copy link
Collaborator

simonw commented Sep 8, 2019

Say you want to fetch Twitter profiles for a list of accounts that are stored in another database:

$ twitter-to-sqlite users-lookup users.db --attach attending.db \
    --sql "select Twitter from attending.attendes where Twitter is not null"

The SQL query you feed in is expected to return a list of screen names suitable for processing further by the command.

Should be supported by all three of:

  • twitter-to-sqlite users-lookup
  • twitter-to-sqlite user-timeline
  • twitter-to-sqlite followers and friends

The --attach option allows other SQLite databases to be attached to the connection. Without it the SQL query will have to read from the single attached database.

@simonw simonw added the enhancement New feature or request label Sep 8, 2019
@simonw
Copy link
Collaborator Author

simonw commented Sep 8, 2019

--attach can optionally take a name for the database connection alias like this:

$ twitter-to-sqlite users-lookup users.db --attach foo:attending.db ...

If you omit the alias: bit the stem of the database (without the file extension) will be used.

@simonw
Copy link
Collaborator Author

simonw commented Sep 8, 2019

ATTACH DATABASE "file:blah.db?mode=ro" AS foo

@simonw
Copy link
Collaborator Author

simonw commented Sep 11, 2019

  • This needs documentation.

@simonw simonw added the documentation Improvements or additions to documentation label Sep 11, 2019
simonw added a commit that referenced this issue Sep 13, 2019
@simonw
Copy link
Collaborator Author

simonw commented Sep 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant