home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

14 rows where "created_at" is on date 2020-03-26 and user = 9599 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: issue_url, created_at (date)

issue 2

  • base_url doesn't entirely work for running Datasette inside Binder 10
  • --dirs option for scanning directories for SQLite databases 4

user 1

  • simonw · 14 ✖

author_association 1

  • OWNER 14
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
604667029 https://github.com/simonw/datasette/pull/672#issuecomment-604667029 https://api.github.com/repos/simonw/datasette/issues/672 MDEyOklzc3VlQ29tbWVudDYwNDY2NzAyOQ== simonw 9599 2020-03-26T20:26:46Z 2020-03-26T20:26:46Z OWNER

I think I can tell what the current file limit is like so: ``` In [1]: import resource

In [2]: resource.getrlimit(resource.RLIMIT_NOFILE)
Out[2]: (256, 9223372036854775807) ``` So maybe I should have Datasette refuse to open more database files than that number minus 5 (to give me some spare room for opening CSS files etc).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--dirs option for scanning directories for SQLite databases 565064079  
604665229 https://github.com/simonw/datasette/pull/672#issuecomment-604665229 https://api.github.com/repos/simonw/datasette/issues/672 MDEyOklzc3VlQ29tbWVudDYwNDY2NTIyOQ== simonw 9599 2020-03-26T20:22:48Z 2020-03-26T20:22:48Z OWNER

I also eventually get this error: Traceback (most recent call last): File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 121, in route_path return await view(new_scope, receive, send) File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 336, in inner_static await asgi_send_file(send, full_path, chunk_size=chunk_size) File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 303, in asgi_send_file async with aiofiles.open(str(filepath), mode="rb") as fp: File "/Users/simonw/.local/share/virtualenvs/datasette-oJRYYJuA/lib/python3.7/site-packages/aiofiles/base.py", line 78, in __aenter__ File "/Users/simonw/.local/share/virtualenvs/datasette-oJRYYJuA/lib/python3.7/site-packages/aiofiles/threadpool/__init__.py", line 35, in _open File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run OSError: [Errno 24] Too many open files: '/Users/simonw/Dropbox/Development/datasette/datasette/static/app.css'

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--dirs option for scanning directories for SQLite databases 565064079  
604569063 https://github.com/simonw/datasette/pull/672#issuecomment-604569063 https://api.github.com/repos/simonw/datasette/issues/672 MDEyOklzc3VlQ29tbWVudDYwNDU2OTA2Mw== simonw 9599 2020-03-26T17:32:06Z 2020-03-26T17:32:06Z OWNER

While running it against a nested directory with a TON of databases I kept seeing errors like this: Traceback (most recent call last): File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 121, in route_path return await view(new_scope, receive, send) File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 193, in view request, **scope["url_route"]["kwargs"] File "/Users/simonw/Dropbox/Development/datasette/datasette/views/index.py", line 58, in get tables[table]["num_relationships_for_sorting"] = count KeyError: 'primary-candidates-2018/rep_candidates' And Traceback (most recent call last): File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 121, in route_path return await view(new_scope, receive, send) File "/Users/simonw/Dropbox/Development/datasette/datasette/utils/asgi.py", line 193, in view request, **scope["url_route"]["kwargs"] File "/Users/simonw/Dropbox/Development/datasette/datasette/views/index.py", line 58, in get tables[table]["num_relationships_for_sorting"] = count KeyError: 'space_used'

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--dirs option for scanning directories for SQLite databases 565064079  
604561639 https://github.com/simonw/datasette/pull/672#issuecomment-604561639 https://api.github.com/repos/simonw/datasette/issues/672 MDEyOklzc3VlQ29tbWVudDYwNDU2MTYzOQ== simonw 9599 2020-03-26T17:22:07Z 2020-03-26T17:22:07Z OWNER

Here's the new utility function I should be using to verify database files that I find:

https://github.com/simonw/datasette/blob/6aa516d82dea9885cb4db8d56ec2ccfd4cd9b840/datasette/utils/init.py#L773-L787

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
--dirs option for scanning directories for SQLite databases 565064079  
604486651 https://github.com/simonw/datasette/issues/712#issuecomment-604486651 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDQ4NjY1MQ== simonw 9599 2020-03-26T15:11:49Z 2020-03-26T15:11:49Z OWNER

And for https://github.com/simonw/jupyterserverproxy-datasette-demo setting "absolute_url": True appears to fix the bug as well (it previously caused an infinite redirect loop but that seems not to happen any more with the latest base_url setting): https://github.com/simonw/jupyterserverproxy-datasette-demo/commit/880f9d50566357160b793557f145c99e74ad759a

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604466523 https://github.com/simonw/datasette/issues/712#issuecomment-604466523 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDQ2NjUyMw== simonw 9599 2020-03-26T14:35:43Z 2020-03-26T14:35:43Z OWNER

Hooray! This is a really great fix, thanks.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604196158 https://github.com/simonw/datasette/issues/712#issuecomment-604196158 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDE5NjE1OA== simonw 9599 2020-03-26T02:43:47Z 2020-03-26T04:20:15Z OWNER

I think the solution here may be to let the incoming x-original-uri header over-ride the raw_path used by Datasette. This may require a new Datasette setting - maybe this:

--config path_from_header:x-original-uri
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604219753 https://github.com/simonw/datasette/issues/712#issuecomment-604219753 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDIxOTc1Mw== simonw 9599 2020-03-26T04:18:13Z 2020-03-26T04:18:13Z OWNER

Woohoo that worked!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604195244 https://github.com/simonw/datasette/issues/712#issuecomment-604195244 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDE5NTI0NA== simonw 9599 2020-03-26T02:40:23Z 2020-03-26T04:17:57Z OWNER

Here's the output of the /-/asgi-scope plugin: {'client': ('10.12.3.15', 0), 'headers': [(b'cookie', b''), (b'upgrade-insecure-requests', b'1'), (b'dnt', b'1'), (b'accept-encoding', b'gzip'), (b'accept-language', b'en-US,en;q=0.5'), (b'accept', b'text/html,application/xhtml+xml,application/xml;q=0.9,image/' b'webp,*/*;q=0.8'), (b'user-agent', b'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:74.0) Gecko' b'/20100101 Firefox/74.0'), (b'x-scheme', b'https'), (b'x-original-uri', b'/user/wragge-datasette-test-czqms2oy/proxy/8001/-/asgi-scope'), (b'x-forwarded-proto', b'https,http'), (b'x-forwarded-port', b'443,80'), (b'x-forwarded-host', b'hub.gke.mybinder.org'), (b'x-forwarded-for', b'148.64.98.14,10.12.3.15'), (b'x-real-ip', b'148.64.98.14'), (b'connection', b'close'), (b'host', b'hub.gke.mybinder.org'), (b'x-forwarded-context', b'/user/wragge-datasette-test-czqms2oy/proxy/8001'), (b'x-proxycontextpath', b'/user/wragge-datasette-test-czqms2oy/proxy/8001')], 'http_version': '1.1', 'method': 'GET', 'path': '/-/asgi-scope', 'query_string': b'', 'raw_path': b'/-/asgi-scope', 'root_path': '', 'scheme': 'https,http', 'server': ('127.0.0.1', 8001), 'type': 'http'} From this output... it looks like the path being passed through to Datasette is still /-/asgi-scope here when I though it would be /user/wragge-datasette-test-czqms2oy/proxy/8001/-/asgi-scope

The original URL path (the one I want) is passed in the x-original-uri HTTP header.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604218449 https://github.com/simonw/datasette/issues/712#issuecomment-604218449 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDIxODQ0OQ== simonw 9599 2020-03-26T04:12:59Z 2020-03-26T04:15:18Z OWNER

I'm running this latest release like so:

Launch this binder: https://mybinder.org/v2/gh/wragge/datasette-test/master?urlpath=lab

Open the notebook.

In the notebook run this:

!pip install datasette-debug-asgi https://github.com/simonw/datasette/archive/7b205af0b53c92d17b69f8c95d70a24a0c06ebce.zip

And use this block to run Datasette:

```

Get current running servers

servers = list_running_servers()

Get the current base url

base_url = next(servers)['base_url']

Create a base url for Datasette suing the proxy path

proxy_url = f'{base_url}proxy/8001/'

Display a link to Datasette

display(HTML(f'

View Datasette (Click on the stop button to close the Datasette server)

'))

Launch Datasette

!datasette -- results.db --port 8001 --config base_url:$proxy_url --config path_from_header:x-original-uri --config template_debug:1 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604194872 https://github.com/simonw/datasette/issues/712#issuecomment-604194872 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDE5NDg3Mg== simonw 9599 2020-03-26T02:38:48Z 2020-03-26T04:04:04Z OWNER

I have a hunch about this: maybe the URLs that work are the ones that use {{ base_url }} directly in the template, while the ones that break are the ones that reconstruct the URL based on the incoming path?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604195577 https://github.com/simonw/datasette/issues/712#issuecomment-604195577 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDE5NTU3Nw== simonw 9599 2020-03-26T02:41:40Z 2020-03-26T02:41:40Z OWNER

Aha! It turns out my demo at https://github.com/simonw/jupyterserverproxy-datasette-demo suffers from the same bug.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604194598 https://github.com/simonw/datasette/issues/712#issuecomment-604194598 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDE5NDU5OA== simonw 9599 2020-03-26T02:37:46Z 2020-03-26T02:37:46Z OWNER

Here's the truncatted HTML for https://hub.gke.mybinder.org/user/wragge-datasette-test-czqms2oy/proxy/8001/results/articles ```html

<html> <head> <title>results: articles: 400 rows </title> <link rel="stylesheet" href="/user/wragge-datasette-test-czqms2oy/proxy/8001/-/static/app.css?4434ab"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> /head> <body class="table db-results table-articles"> <nav class="hd">

home / results

</nav>

articles

400 rows

<form class="filters" action="/user/wragge-datasette-test-czqms2oy/proxy/8001/results/articles" method="get"> ... </form>

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: newspaper_id, newspaper_title, page, category, illustrated, corrections, date (date)

<table class="rows-and-columns"> <thead> <tr> <th class="col-Link" scope="col"> Link </th> <th class="col-rowid" scope="col"> rowid ▼ </th> ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  
604193362 https://github.com/simonw/datasette/issues/712#issuecomment-604193362 https://api.github.com/repos/simonw/datasette/issues/712 MDEyOklzc3VlQ29tbWVudDYwNDE5MzM2Mg== simonw 9599 2020-03-26T02:32:57Z 2020-03-26T02:32:57Z OWNER

Weird... the unit test I just added passes. So suggested facets look like they're OK.

And yet the demo in https://mybinder.org/v2/gh/wragge/datasette-test/master?urlpath=lab doesn't work.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
base_url doesn't entirely work for running Datasette inside Binder 588108428  

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 1082.42ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows