home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

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

issue 1

  • table.create(..., replace=True) · 7 ✖

author_association 1

  • OWNER 7
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1646655272 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646655272 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJfco simonw 9599 2023-07-22T19:25:35Z 2023-07-22T19:25:35Z OWNER

Here's why that test broke: https://github.com/simonw/sqlite-utils/blob/58b577279fcd5ef6ce88f88b28668dffebfe7f44/sqlite_utils/db.py#L960-L964

I added an extra if self[name].exists() check to the db.create_table() method.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  
1646654818 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646654818 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJfVi simonw 9599 2023-07-22T19:22:40Z 2023-07-22T19:22:40Z OWNER

I think this broke a test: ``` $ pytest tests/test_tracer.py
=============================================== test session starts ================================================ platform darwin -- Python 3.11.4, pytest-7.2.2, pluggy-1.0.0 rootdir: /Users/simon/Dropbox/Development/sqlite-utils plugins: icdiff-0.6, hypothesis-6.68.2 collected 2 items

tests/test_tracer.py F. [100%]

===================================================== FAILURES ===================================================== _________ test_tracer __________

def test_tracer():
    collected = []
    db = Database(
        memory=True, tracer=lambda sql, params: collected.append((sql, params))
    )
    db["dogs"].insert({"name": "Cleopaws"})
    db["dogs"].enable_fts(["name"])
    db["dogs"].search("Cleopaws")
  assert collected == [
        ("PRAGMA recursive_triggers=on;", None),
        ("select name from sqlite_master where type = 'view'", None),
        ("select name from sqlite_master where type = 'table'", None),
        ("select name from sqlite_master where type = 'view'", None),
        ("CREATE TABLE [dogs] (\n   [name] TEXT\n);\n        ", None),
        ("select name from sqlite_master where type = 'view'", None),
        ("INSERT INTO [dogs] ([name]) VALUES (?);", ["Cleopaws"]),
        ("select name from sqlite_master where type = 'view'", None),
        (
            "CREATE VIRTUAL TABLE [dogs_fts] USING FTS5 (\n    [name],\n    content=[dogs]\n)",
            None,
        ),
        (
            "INSERT INTO [dogs_fts] (rowid, [name])\n    SELECT rowid, [name] FROM [dogs];",
            None,
        ),
        ("select name from sqlite_master where type = 'view'", None),
    ]

E assert equals failed E [ [
E ('PRAGMA recursive_triggers=on;', None), ('PRAGMA recursive_triggers=on;', None),
E (
E "select name from sqlite_master where type =
E 'view'",
E None, ... E
E ...Full output truncated (13 lines hidden), use '-vv' to show

tests/test_tracer.py:12: AssertionError ============================================= short test summary info ============================================== FAILED tests/test_tracer.py::test_tracer - assert equals failed =========================================== 1 failed, 1 passed in 0.05s ============================================ ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  
1646653610 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646653610 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJfCq simonw 9599 2023-07-22T19:14:56Z 2023-07-22T19:14:56Z OWNER

Manual testing of CLI command as well: $ sqlite-utils create-table /tmp/f.db foo id integer $ sqlite-utils create-table /tmp/f.db foo id integer Error: Table "foo" already exists. Use --replace to delete and replace it. $ sqlite-utils create-table /tmp/f.db foo id integer --replace $ sqlite-utils create-table /tmp/f.db foo id $ sqlite-utils schema /tmp/f.db CREATE TABLE [foo] ( [id] INTEGER ); $ sqlite-utils create-table /tmp/f.db foo id integer name str --transform Error: column types must be one of ('INTEGER', 'TEXT', 'FLOAT', 'BLOB') $ sqlite-utils create-table /tmp/f.db foo id integer name text --transform $ sqlite-utils schema /tmp/f.db CREATE TABLE "foo" ( [id] INTEGER, [name] TEXT ); $ sqlite-utils create-table /tmp/f.db foo id integer name text --ignore $ sqlite-utils create-table /tmp/f.db foo id integer name text --replace $ sqlite-utils schema /tmp/f.db CREATE TABLE [foo] ( [id] INTEGER, [name] TEXT );

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  
1646653382 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646653382 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJe_G simonw 9599 2023-07-22T19:13:20Z 2023-07-22T19:13:20Z OWNER

Demo: ```pycon

from sqlite_utils import Database db = Database(memory=True) db["foo"].create({"id": int})

<Table foo (id)> >>> db["foo"].create({"id": int}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/db.py", line 1647, in create self.db.create_table( File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/db.py", line 1030, in create_table self.execute(sql) File "/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/db.py", line 510, in execute return self.conn.execute(sql) ^^^^^^^^^^^^^^^^^^^^^^ sqlean.dbapi2.OperationalError: table [foo] already exists >>> db["foo"].create({"id": int}, ignore=True) <Table foo (id)> >>> db["foo"].create({"id": int, "name": str}, replace=True) <Table foo (id, name)> >>> db["foo"].create({"id": int, "name": str, "age": int}, transform=True) <Table foo (id, name, age)> ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  
1646652105 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646652105 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJerJ simonw 9599 2023-07-22T19:05:13Z 2023-07-22T19:05:13Z OWNER

I think this is replace=True and ignore=True to match the CLI. And refactoring the CLI to use them.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  
1646642959 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646642959 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJccP simonw 9599 2023-07-22T18:14:49Z 2023-07-22T18:14:49Z OWNER

Here's where those are implemented for the create-table CLI command: https://github.com/simonw/sqlite-utils/blob/f7af23837deab5c98dae9441d1f68318065d7d8c/sqlite_utils/cli.py#L1543-L1564

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  
1646642666 https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646642666 https://api.github.com/repos/simonw/sqlite-utils/issues/568 IC_kwDOCGYnMM5iJcXq simonw 9599 2023-07-22T18:13:19Z 2023-07-22T18:13:19Z OWNER

https://sqlite-utils.datasette.io/en/stable/cli-reference.html#create-table

bash sqlite-utils create-table ... --replace That also has --ignore:

--ignore If table already exists, do nothing --replace If table already exists, replace it --transform If table already exists, try to transform the schema

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
table.create(..., replace=True) 1816851056  

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