home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 1699174055 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 4

issue 1

  • `--raw-lines` option, like `--raw` for multiple lines · 4 ✖

author_association 1

  • OWNER 4
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1537514610 https://github.com/simonw/sqlite-utils/issues/539#issuecomment-1537514610 https://api.github.com/repos/simonw/sqlite-utils/issues/539 IC_kwDOCGYnMM5bpJxy simonw 9599 2023-05-07T18:43:24Z 2023-05-07T18:43:24Z OWNER

Documentation: - https://sqlite-utils.datasette.io/en/latest/cli.html#returning-raw-data-such-as-binary-content - https://sqlite-utils.datasette.io/en/latest/cli-reference.html#query - https://sqlite-utils.datasette.io/en/latest/cli-reference.html#memory

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`--raw-lines` option, like `--raw` for multiple lines 1699174055  
1537507676 https://github.com/simonw/sqlite-utils/issues/539#issuecomment-1537507676 https://api.github.com/repos/simonw/sqlite-utils/issues/539 IC_kwDOCGYnMM5bpIFc simonw 9599 2023-05-07T18:09:43Z 2023-05-07T18:09:54Z OWNER

This worked:

bash sqlite-utils memory /tmp/books3.json:nl \ 'select name from books3' --raw-lines > titles.txt

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`--raw-lines` option, like `--raw` for multiple lines 1699174055  
1537507525 https://github.com/simonw/sqlite-utils/issues/539#issuecomment-1537507525 https://api.github.com/repos/simonw/sqlite-utils/issues/539 IC_kwDOCGYnMM5bpIDF simonw 9599 2023-05-07T18:09:09Z 2023-05-07T18:09:09Z OWNER

I'm tempted to upgrade --raw to do this instead, but that would be a breaking change.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`--raw-lines` option, like `--raw` for multiple lines 1699174055  
1537507394 https://github.com/simonw/sqlite-utils/issues/539#issuecomment-1537507394 https://api.github.com/repos/simonw/sqlite-utils/issues/539 IC_kwDOCGYnMM5bpIBC simonw 9599 2023-05-07T18:08:44Z 2023-05-07T18:08:44Z OWNER

Prototype: ``diff diff --git a/docs/cli-reference.rst b/docs/cli-reference.rst index 153e5f9..c830518 100644 --- a/docs/cli-reference.rst +++ b/docs/cli-reference.rst @@ -124,6 +124,7 @@ See :ref:cli_query. --json-cols Detect JSON cols and output them as JSON, not escaped strings -r, --raw Raw output, first column of first row + --raw-lines Raw output, first column of each row -p, --param <TEXT TEXT>... Named :parameters for SQL query --functions TEXT Python code defining one or more custom SQL functions @@ -192,6 +193,7 @@ See :ref:cli_memory`. --json-cols Detect JSON cols and output them as JSON, not escaped strings -r, --raw Raw output, first column of first row + --raw-lines Raw output, first column of each row -p, --param <TEXT TEXT>... Named :parameters for SQL query --encoding TEXT Character encoding for CSV input, defaults to utf-8 diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index d25b1df..da0e4b6 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -1653,6 +1653,7 @@ def drop_view(path, view, ignore, load_extension): ) @output_options @click.option("-r", "--raw", is_flag=True, help="Raw output, first column of first row") +@click.option("--raw-lines", is_flag=True, help="Raw output, first column of each row") @click.option( "-p", "--param", @@ -1677,6 +1678,7 @@ def query( fmt, json_cols, raw, + raw_lines, param, load_extension, functions, @@ -1700,7 +1702,19 @@ def query( _register_functions(db, functions)

 _execute_query(
  • db, sql, param, raw, table, csv, tsv, no_headers, fmt, nl, arrays, json_cols
  • db,
  • sql,
  • param,
  • raw,
  • raw_lines,
  • table,
  • csv,
  • tsv,
  • no_headers,
  • fmt,
  • nl,
  • arrays,
  • json_cols, )

@@ -1728,6 +1742,7 @@ def query( ) @output_options @click.option("-r", "--raw", is_flag=True, help="Raw output, first column of first row") +@click.option("--raw-lines", is_flag=True, help="Raw output, first column of each row") @click.option( "-p", "--param", @@ -1773,6 +1788,7 @@ def memory( fmt, json_cols, raw, + raw_lines, param, encoding, no_detect_types, @@ -1879,12 +1895,36 @@ def memory( _register_functions(db, functions)

 _execute_query(
  • db, sql, param, raw, table, csv, tsv, no_headers, fmt, nl, arrays, json_cols
  • db,
  • sql,
  • param,
  • raw,
  • raw_lines,
  • table,
  • csv,
  • tsv,
  • no_headers,
  • fmt,
  • nl,
  • arrays,
  • json_cols, )

def _execute_query( - db, sql, param, raw, table, csv, tsv, no_headers, fmt, nl, arrays, json_cols + db, + sql, + param, + raw, + raw_lines, + table, + csv, + tsv, + no_headers, + fmt, + nl, + arrays, + json_cols, ): with db.conn: try: @@ -1903,6 +1943,13 @@ def _execute_query( sys.stdout.buffer.write(data) else: sys.stdout.write(str(data)) + elif raw_lines: + for row in cursor: + data = row[0] + if isinstance(data, bytes): + sys.stdout.buffer.write(data + b"\n") + else: + sys.stdout.write(str(data) + "\n") elif fmt or table: print( tabulate.tabulate( ``` Needs tests and more documentation.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`--raw-lines` option, like `--raw` for multiple lines 1699174055  

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