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

Open
simonw opened this issue Sep 8, 2019 · 4 comments

Comments

@simonw
Copy link
Collaborator

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 following

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 label Sep 8, 2019
@simonw

This comment has been minimized.

Copy link
Collaborator Author

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

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 8, 2019

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

simonw added a commit that referenced this issue Sep 8, 2019
@simonw

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 11, 2019

  • This needs documentation.
simonw added a commit that referenced this issue Sep 13, 2019
@simonw

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.