home / github

Menu
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where issue = 1097128334

✎ View and edit SQL

This data as json, CSV (advanced)

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

id ▼ html_url issue_url node_id user created_at updated_at author_association body reactions issue performed_via_github_app
1008246239 https://github.com/simonw/sqlite-utils/issues/371#issuecomment-1008246239 https://api.github.com/repos/simonw/sqlite-utils/issues/371 IC_kwDOCGYnMM48GJ3f simonw 9599 2022-01-09T07:41:24Z 2022-01-09T07:41:24Z OWNER Might be a case of modifying this line: https://github.com/simonw/sqlite-utils/blob/e0c476bc380744680c8b7675c24fb0e9f5ec6dcd/sqlite_utils/cli.py#L828 To: ```python docs = (fn(doc) or doc for doc in docs) ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Support mutating row in `--convert` without returning it 1097128334  
1008246366 https://github.com/simonw/sqlite-utils/issues/371#issuecomment-1008246366 https://api.github.com/repos/simonw/sqlite-utils/issues/371 IC_kwDOCGYnMM48GJ5e simonw 9599 2022-01-09T07:42:14Z 2022-01-09T07:42:14Z OWNER Also need to update relevant docs for that example. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Support mutating row in `--convert` without returning it 1097128334  
1008347768 https://github.com/simonw/sqlite-utils/issues/371#issuecomment-1008347768 https://api.github.com/repos/simonw/sqlite-utils/issues/371 IC_kwDOCGYnMM48Gip4 simonw 9599 2022-01-09T18:12:30Z 2022-01-09T18:12:30Z OWNER Tried this test: ```python result = CliRunner().invoke( cli.cli, [ "insert", db_path, "rows", "-", "--convert", 'row["is_chicken"] = True', ], input='{"name": "Azi"}', ) ``` And got this error: > `E + where 1 = <Result SyntaxError('invalid syntax', ('<string>', 2, 30, ' return row["is_chicken"] = True\n'))>.exit_code` The code snippet compilation isn't currently compatible with this. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Support mutating row in `--convert` without returning it 1097128334  
1008348032 https://github.com/simonw/sqlite-utils/issues/371#issuecomment-1008348032 https://api.github.com/repos/simonw/sqlite-utils/issues/371 IC_kwDOCGYnMM48GiuA simonw 9599 2022-01-09T18:14:02Z 2022-01-09T18:14:02Z OWNER Here's the code in question: https://github.com/simonw/sqlite-utils/blob/b8c134059e89f0fa040b84fb7d0bda25b9a52759/sqlite_utils/utils.py#L288-L299 {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Support mutating row in `--convert` without returning it 1097128334  
1008354207 https://github.com/simonw/sqlite-utils/issues/371#issuecomment-1008354207 https://api.github.com/repos/simonw/sqlite-utils/issues/371 IC_kwDOCGYnMM48GkOf simonw 9599 2022-01-09T18:54:54Z 2022-01-09T18:54:54Z OWNER This seems to work: ```python def _compile_code(code, imports, variable="value"): locals = {} globals = {"r": recipes, "recipes": recipes} # If user defined a convert() function, return that try: exec(code, globals, locals) return locals["convert"] except (AttributeError, SyntaxError, NameError, KeyError, TypeError): pass # Try compiling their code as a function instead body_variants = [code] # If single line and no 'return', try adding the return if "\n" not in code and not code.strip().startswith("return "): body_variants.insert(0, "return {}".format(code)) for variant in body_variants: new_code = ["def fn({}):".format(variable)] for line in variant.split("\n"): new_code.append(" {}".format(line)) try: code_o = compile("\n".join(new_code), "<string>", "exec") break except SyntaxError: # Try another variant, e.g. for 'return row["column"] = 1' continue for import_ in imports: globals[import_.split(".")[0]] = __import__(import_) exec(code_o, globals, locals) return locals["fn"] ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Support mutating row in `--convert` without returning it 1097128334  
1008364701 https://github.com/simonw/sqlite-utils/issues/371#issuecomment-1008364701 https://api.github.com/repos/simonw/sqlite-utils/issues/371 IC_kwDOCGYnMM48Gmyd simonw 9599 2022-01-09T20:04:35Z 2022-01-09T20:04:35Z OWNER The previous code for highlighting errors in syntax (which was already a bit confused thanks to the added `return`, see https://github.com/simonw/sqlite-utils/issues/355#issuecomment-991393684 - isn't compatible with this approach at all. I'm going to ditch it and just show a generic `Error: Could not compile code` message. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Support mutating row in `--convert` without returning it 1097128334  

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 24.097ms · About: simonw/datasette-graphql