home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1065596417

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/sqlite-utils/issues/411#issuecomment-1065596417 https://api.github.com/repos/simonw/sqlite-utils/issues/411 1065596417 IC_kwDOCGYnMM4_g7YB 9599 2022-03-11T22:30:15Z 2022-03-11T22:30:15Z OWNER

I tried it out in Jupyter and it works as advertised:

Introspection is a bit weird: there doesn't seem to be a way to introspect generated columns outside of parsing the stored SQL schema for the columns at the moment! And the .columns method doesn't return them at all:

https://github.com/simonw/sqlite-utils/blob/433813612ff9b4b501739fd7543bef0040dd51fe/sqlite_utils/db.py#L1207-L1213

Here's why:

```

db.execute("PRAGMA table_info('t')").fetchall() [(0, 'body', 'TEXT', 0, None, 0)] db.execute("PRAGMA table_xinfo('t')").fetchall() [(0, 'body', 'TEXT', 0, None, 0, 0), (1, 'd', 'INT', 0, None, 0, 2)] `` Sotable_xinfo()` is needed to get back columns including generated columns: https://www.sqlite.org/pragma.html#pragma_table_xinfo

PRAGMA schema.table_xinfo(table-name);

This pragma returns one row for each column in the named table, including hidden columns in virtual tables. The output is the same as for PRAGMA table_info except that hidden columns are shown rather than being omitted.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1160034488  
Powered by Datasette · Queries took 0.846ms · About: github-to-sqlite