home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

11 rows where author_association = "MEMBER" and issue = 590666760 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw 11

issue 1

  • --since feature can be confused by retweets · 11 ✖

author_association 1

  • MEMBER · 11 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
607010634 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-607010634 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNzAxMDYzNA== simonw 9599 2020-04-01T03:45:16Z 2020-04-01T03:45:16Z MEMBER

OK, fix is applied to everything now.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
607003655 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-607003655 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNzAwMzY1NQ== simonw 9599 2020-04-01T03:18:00Z 2020-04-01T03:18:00Z MEMBER

I've got this working for the user-timeline command.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606850453 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606850453 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjg1MDQ1Mw== simonw 9599 2020-03-31T20:14:58Z 2020-04-01T03:03:50Z MEMBER

Actually I'll hard-code the population of since_id_types to get known ID constants.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606998669 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606998669 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjk5ODY2OQ== simonw 9599 2020-04-01T02:57:36Z 2020-04-01T02:57:36Z MEMBER

The tricky thing here is thinking about the interaction between the recorded since_id and a desire to run the initial import.

The first time you run twitter-to-sqlite user-timeline db.db username we want to fetch as many tweets from that user as possible - probably around 3,200 before the API limitations cut us off.

We need to record the maximum ID from those as the since_id - which we will see on the very first page we paginate through. That way next time we run the command with --since we will only fetch new tweets.

But what happens if our initial import is cancelled after only a few tweets? We risk never pulling in the rest of the tweets.

Not sure if I need to solve this at all or if I should instead trust users to run the command a second time without --since if they think they didn't retrieve anything the first time.

I had considered letting --stop_after= over-ride --since but that doesn't actually make sense - if you send a since_id to the Twitter API you'll never get back more tweets than exist after that ID, so the --stop_after would not make a meaningful difference.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606850008 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606850008 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjg1MDAwOA== simonw 9599 2020-03-31T20:13:59Z 2020-04-01T00:23:00Z MEMBER

Table design for since_ids table:

type | key | since_id --- | --- | --- 1 | 124324 | 2347239847293 2 | 99ff9cefff5cbfd804f7cd43e2b27ced8addbe8d | 2125947927344

Primary compound key on (category, key)

type is also a foreign key to a since_id_types table with id and name columns (probably created using https://sqlite-utils.readthedocs.io/en/stable/python-api.html#working-with-lookup-tables )

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606843224 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606843224 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjg0MzIyNA== simonw 9599 2020-03-31T19:59:11Z 2020-03-31T20:06:32Z MEMBER

Or... have a single since_ids table to track since values, and have its primary key be a string that looks something like this:

user:123145 home:23441 mentions:23425 search:99ff9cefff5cbfd804f7cd43e2b27ced8addbe8d

That last example would use the hash generated here:

https://github.com/dogsheep/twitter-to-sqlite/blob/810cb2af5a175837204389fd7f4b5721f8b325ab/twitter_to_sqlite/cli.py#L792-L808

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606844521 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606844521 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjg0NDUyMQ== simonw 9599 2020-03-31T20:01:39Z 2020-03-31T20:01:39Z MEMBER

I think utils.fetch_timeline() grows a new argument, since_key.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606824992 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606824992 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjgyNDk5Mg== simonw 9599 2020-03-31T19:24:23Z 2020-03-31T19:24:23Z MEMBER

The --since option is actually used by four commands:

  • user-timeline
  • home-timeline
  • mentions-timeline
  • search

All of them use the same fetch_timeline() utility function under the hood. I should move the logic that looks up the last since_id into that shared function.

Question: should I have a table for each of those four methods or a single table that is used by them all? I'm leaning towards four separate tables.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606309165 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606309165 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjMwOTE2NQ== simonw 9599 2020-03-30T23:41:31Z 2020-03-30T23:41:31Z MEMBER

I like the separate user_timeline_since table solution.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606305701 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606305701 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjMwNTcwMQ== simonw 9599 2020-03-30T23:30:27Z 2020-03-30T23:30:27Z MEMBER

A better alternative would be to maintain a separate table with the last seen since value for when we ran user-timeline for any specific user.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  
606304837 https://github.com/dogsheep/twitter-to-sqlite/issues/39#issuecomment-606304837 https://api.github.com/repos/dogsheep/twitter-to-sqlite/issues/39 MDEyOklzc3VlQ29tbWVudDYwNjMwNDgzNw== simonw 9599 2020-03-30T23:27:50Z 2020-03-30T23:29:31Z MEMBER

One option would be something like this: sql select max(id) from tweets where user = ? and not exists (select id from tweets where retweeted_status = id) and not exists (select id from tweets where quoted_status = id) and not exists (select id from tweets where in_reply_to_status_id = id) Might be a good idea to index those columns (after confirming that doing so would indeed speed up the query).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--since feature can be confused by retweets 590666760  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 21.634ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows