{"html_url": "https://github.com/simonw/sqlite-utils/issues/261#issuecomment-853541869", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/261", "id": 853541869, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU0MTg2OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T03:54:14Z", "updated_at": "2021-06-03T03:54:14Z", "author_association": "OWNER", "body": "Documentation: https://sqlite-utils.datasette.io/en/latest/python-api.html#xindexes", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906345899, "label": "`table.xindexes` using `PRAGMA index_xinfo(table)`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/261#issuecomment-853535559", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/261", "id": 853535559, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzUzNTU1OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T03:32:47Z", "updated_at": "2021-06-03T03:32:47Z", "author_association": "OWNER", "body": "New design:\r\n```python\r\ndef test_xindexes(fresh_db):\r\n fresh_db.executescript(\r\n \"\"\"\r\n create table Gosh (c1 text, c2 text, c3 text);\r\n create index Gosh_c1 on Gosh(c1);\r\n create index Gosh_c2c3 on Gosh(c2, c3 desc);\r\n \"\"\"\r\n )\r\n assert fresh_db[\"Gosh\"].xindexes == [\r\n XIndex(\r\n name=\"Gosh_c2c3\",\r\n columns=[\r\n XIndexColumn(seqno=0, cid=1, name=\"c2\", desc=0, coll=\"BINARY\", key=1),\r\n XIndexColumn(seqno=1, cid=2, name=\"c3\", desc=1, coll=\"BINARY\", key=1),\r\n XIndexColumn(seqno=2, cid=-1, name=None, desc=0, coll=\"BINARY\", key=0),\r\n ],\r\n ),\r\n XIndex(\r\n name=\"Gosh_c1\",\r\n columns=[\r\n XIndexColumn(seqno=0, cid=0, name=\"c1\", desc=0, coll=\"BINARY\", key=1),\r\n XIndexColumn(seqno=1, cid=-1, name=None, desc=0, coll=\"BINARY\", key=0),\r\n ],\r\n ),\r\n ]\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906345899, "label": "`table.xindexes` using `PRAGMA index_xinfo(table)`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/261#issuecomment-853534732", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/261", "id": 853534732, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzUzNDczMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T03:30:10Z", "updated_at": "2021-06-03T03:30:10Z", "author_association": "OWNER", "body": "I'm going to return `XIndex(name, columns)` - where `columns` is a list of `XIndexColumn`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906345899, "label": "`table.xindexes` using `PRAGMA index_xinfo(table)`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/261#issuecomment-853530348", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/261", "id": 853530348, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzUzMDM0OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T03:16:33Z", "updated_at": "2021-06-03T03:16:33Z", "author_association": "OWNER", "body": "In prototyping this out I realize that I actually want to get back the name of each index, then for each of them the detailed list of index columns. Here's the test from my initial prototype:\r\n```python\r\ndef test_xindexes(fresh_db):\r\n fresh_db.executescript(\r\n \"\"\"\r\n create table Gosh (c1 text, c2 text, c3 text);\r\n create index Gosh_c1 on Gosh(c1);\r\n create index Gosh_c2c3 on Gosh(c2, c3 desc);\r\n \"\"\"\r\n )\r\n assert fresh_db[\"Gosh\"].xindexes == [\r\n (\r\n \"Gosh_c2c3\",\r\n [\r\n XIndex(seqno=0, cid=1, name=\"c2\", desc=0, coll=\"BINARY\", key=1),\r\n XIndex(seqno=1, cid=2, name=\"c3\", desc=1, coll=\"BINARY\", key=1),\r\n XIndex(seqno=2, cid=-1, name=None, desc=0, coll=\"BINARY\", key=0),\r\n ],\r\n ),\r\n (\r\n \"Gosh_c1\",\r\n [\r\n XIndex(seqno=0, cid=0, name=\"c1\", desc=0, coll=\"BINARY\", key=1),\r\n XIndex(seqno=1, cid=-1, name=None, desc=0, coll=\"BINARY\", key=0),\r\n ],\r\n ),\r\n ]\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906345899, "label": "`table.xindexes` using `PRAGMA index_xinfo(table)`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/261#issuecomment-853525036", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/261", "id": 853525036, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzUyNTAzNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T03:02:22Z", "updated_at": "2021-06-03T03:02:22Z", "author_association": "OWNER", "body": "This would be a breaking change - and the fact that it returns auxiliary columns isn't particularly useful for most cases - \"Auxiliary columns are additional columns needed to locate the table entry that corresponds to each index entry\".\r\n\r\nInstead, I'm going to add a new property `table.xindexes` which exposes this.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906345899, "label": "`table.xindexes` using `PRAGMA index_xinfo(table)`"}, "performed_via_github_app": null}