{"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/263#issuecomment-853544493", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/263", "id": 853544493, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU0NDQ5Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:03:59Z", "updated_at": "2021-06-03T04:03:59Z", "author_association": "OWNER", "body": "Here's how `sqlite-utils triggers` works: https://github.com/simonw/sqlite-utils/blob/9c67cb925253cd5ef54a1fe0496e0ff9caeacfd6/sqlite_utils/cli.py#L1266-L1277\r\n\r\nRunning it from a SQL query makes it easy to support modifiers like `--csv` and `-t`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906356331, "label": "`sqlite-utils indexes` command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/263#issuecomment-853545743", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/263", "id": 853545743, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU0NTc0Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:08:04Z", "updated_at": "2021-06-03T04:08:04Z", "author_association": "OWNER", "body": "Figuring out the right queries:\r\n\r\nhttps://covid-19.datasettes.com/covid?sql=select+sqlite_master.name%2C+i.*+from+sqlite_master%0D%0Ajoin+pragma_index_list%28sqlite_master.name%29+i%0D%0Awhere+type+%3D+%27table%27\r\n\r\nThis query shows all columns across all indexes across all tables:\r\n\r\n```sql\r\nselect i.name as index_name, xinfo.* from sqlite_master\r\njoin pragma_index_list(sqlite_master.name) i\r\njoin pragma_index_xinfo(index_name) xinfo\r\nwhere sqlite_master.type = 'table'\r\n```\r\nhttps://covid-19.datasettes.com/covid?sql=select+i.name+as+index_name%2C+xinfo.*+from+sqlite_master%0D%0Ajoin+pragma_index_list%28sqlite_master.name%29+i%0D%0Ajoin+pragma_index_xinfo%28index_name%29+xinfo%0D%0Awhere+sqlite_master.type+%3D+%27table%27", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906356331, "label": "`sqlite-utils indexes` command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/263#issuecomment-853546818", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/263", "id": 853546818, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU0NjgxOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:11:46Z", "updated_at": "2021-06-03T04:11:46Z", "author_association": "OWNER", "body": "By default I won't return auxiliary columns, but I'll offer a `--aux` option to return them.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906356331, "label": "`sqlite-utils indexes` command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/263#issuecomment-853547681", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/263", "id": 853547681, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU0NzY4MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:14:28Z", "updated_at": "2021-06-03T04:14:28Z", "author_association": "OWNER", "body": "This looks good:\r\n```\r\n% sqlite-utils indexes /tmp/covid.db -t \r\nindex_name seqno cid name desc coll key\r\n------------------------------------------------------ ------- ----- ----------------- ------ ------ -----\r\nidx_johns_hopkins_csse_daily_reports_combined_key 0 12 combined_key 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_country_or_region 0 1 country_or_region 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_province_or_state 0 2 province_or_state 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_day 0 0 day 0 BINARY 1\r\nidx_ny_times_us_counties_date 0 0 date 1 BINARY 1\r\nidx_ny_times_us_counties_fips 0 3 fips 0 BINARY 1\r\nidx_ny_times_us_counties_county 0 1 county 0 BINARY 1\r\nidx_ny_times_us_counties_state 0 2 state 0 BINARY 1\r\n\r\n% sqlite-utils indexes /tmp/covid.db -t --aux\r\nindex_name seqno cid name desc coll key\r\n------------------------------------------------------ ------- ----- ----------------- ------ ------ -----\r\nidx_johns_hopkins_csse_daily_reports_combined_key 0 12 combined_key 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_combined_key 1 -1 0 BINARY 0\r\nidx_johns_hopkins_csse_daily_reports_country_or_region 0 1 country_or_region 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_country_or_region 1 -1 0 BINARY 0\r\nidx_johns_hopkins_csse_daily_reports_province_or_state 0 2 province_or_state 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_province_or_state 1 -1 0 BINARY 0\r\nidx_johns_hopkins_csse_daily_reports_day 0 0 day 0 BINARY 1\r\nidx_johns_hopkins_csse_daily_reports_day 1 -1 0 BINARY 0\r\nidx_ny_times_us_counties_date 0 0 date 1 BINARY 1\r\nidx_ny_times_us_counties_date 1 -1 0 BINARY 0\r\nidx_ny_times_us_counties_fips 0 3 fips 0 BINARY 1\r\nidx_ny_times_us_counties_fips 1 -1 0 BINARY 0\r\nidx_ny_times_us_counties_county 0 1 county 0 BINARY 1\r\nidx_ny_times_us_counties_county 1 -1 0 BINARY 0\r\nidx_ny_times_us_counties_state 0 2 state 0 BINARY 1\r\nidx_ny_times_us_counties_state 1 -1 0 BINARY 0\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906356331, "label": "`sqlite-utils indexes` command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/263#issuecomment-853548442", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/263", "id": 853548442, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU0ODQ0Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:16:49Z", "updated_at": "2021-06-03T04:16:49Z", "author_association": "OWNER", "body": "Needs to show the table each index applies to.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906356331, "label": "`sqlite-utils indexes` command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/264#issuecomment-853553754", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/264", "id": 853553754, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU1Mzc1NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:32:42Z", "updated_at": "2021-06-03T04:36:36Z", "author_association": "OWNER", "body": "This is a really interesting thought. I've so far resisted the temptation to add plugins to `sqlite-utils`, partly to avoid overlap with Datasette - but I'm open to discussing it.\r\n\r\nThere's actually a way for you to do what you're describing using `datasette` on the command-line, though it's a little obscure - also Datasette doesn't yet have a GeoJSON output extension, though it really should have one.\r\n\r\nHere's an example using [datasette-yaml](https://datasette.io/plugins/datasette-yaml):\r\n\r\n```\r\ndatasette /tmp/covid.db --get='/covid/ny_times_us_counties.yaml'\r\n- rowid: 1\r\n date: '2020-01-21'\r\n county: Snohomish\r\n state: Washington\r\n fips: 53061\r\n cases: 1\r\n deaths: 0\r\n- rowid: 2\r\n date: '2020-01-22'\r\n county: Snohomish\r\n state: Washington\r\n fips: 53061\r\n cases: 1\r\n deaths: 0\r\n```\r\nIt even works with arbitrary SQL queries, though you might have to apply URL encoding to the `--get` string (this seems to work though):\r\n```\r\ndatasette /tmp/covid.db --get='/covid.yaml?sql=select * from ny_times_us_counties limit 2' \r\n- date: '2020-01-21'\r\n county: Snohomish\r\n state: Washington\r\n fips: 53061\r\n cases: 1\r\n deaths: 0\r\n- date: '2020-01-22'\r\n county: Snohomish\r\n state: Washington\r\n fips: 53061\r\n cases: 1\r\n deaths: 0\r\n```\r\nHere's the documentation for `--get`: https://docs.datasette.io/en/latest/getting_started.html#datasette-get", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 907642546, "label": "Supporting additional output formats, like GeoJSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/263#issuecomment-853554550", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/263", "id": 853554550, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU1NDU1MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:34:38Z", "updated_at": "2021-06-03T04:34:38Z", "author_association": "OWNER", "body": "Documentation: https://sqlite-utils.datasette.io/en/latest/cli.html#listing-indexes", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 906356331, "label": "`sqlite-utils indexes` command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1355#issuecomment-853557439", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1355", "id": 853557439, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU1NzQzOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:43:14Z", "updated_at": "2021-06-03T04:43:14Z", "author_association": "OWNER", "body": "It's using `TestClient` at the moment which is a wrapper around `httpx` (as of ) that uses the `@async_to_sync` decorator to hide the async nature.\r\n\r\nhttps://github.com/simonw/datasette/blob/f78ebdc04537a6102316d6dbbf6c887565806078/datasette/utils/testing.py#L102-L156\r\n\r\nMaybe the fix here is to switch the `--get` implementation to using `httpx` directly with https://www.python-httpx.org/async/#streaming-responses", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910088936, "label": "datasette --get should efficiently handle streaming CSV"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/264#issuecomment-853558741", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/264", "id": 853558741, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU1ODc0MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:47:19Z", "updated_at": "2021-06-03T04:47:19Z", "author_association": "OWNER", "body": "This inspired me to re-examine how `--get` works, hence this issue: https://github.com/simonw/datasette/issues/1355", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 907642546, "label": "Supporting additional output formats, like GeoJSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853559915", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853559915, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU1OTkxNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:50:52Z", "updated_at": "2021-06-03T04:50:52Z", "author_association": "OWNER", "body": "What happens if you pass multiple databases? The `--query` would be executed against the first one. And if you pass `--crossdb` it would be executed against the `/_memory` database and would support cross-database joins.\r\n\r\nKey thing here is that output plugins are supported (also plugins that add new SQL functions), making many Datasette plugins usable from the command-line.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853560237", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853560237, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2MDIzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:51:49Z", "updated_at": "2021-06-03T04:51:49Z", "author_association": "OWNER", "body": "This feels like a relatively simple feature to implement that unlocks a whole new set of possible uses for Datasette - as described by @eyeseast in https://github.com/simonw/sqlite-utils/issues/264#issue-907642546.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853560389", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853560389, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2MDM4OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:52:13Z", "updated_at": "2021-06-03T04:52:13Z", "author_association": "OWNER", "body": "I should implement #1355 for more efficient `--csv` streaming as part of this.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853560870", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853560870, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2MDg3MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:53:47Z", "updated_at": "2021-06-03T04:53:56Z", "author_association": "OWNER", "body": "This is also interesting when used in conjunction with the proposed `datasette insert` command from #1163 - Datasette would become a plugin-driven CLI tool for both ingesting and outputting data, as a side-effect of its web features.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853562891", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853562891, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2Mjg5MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T04:59:40Z", "updated_at": "2021-06-03T04:59:40Z", "author_association": "OWNER", "body": "It's weird that `--get` is documented on this page right now: https://docs.datasette.io/en/stable/getting_started.html#datasette-get\r\n\r\nIf I implement this I should build a new \"Datasette on the command-line\" documentation page to cover both `--get` and `--query`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853565850", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853565850, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2NTg1MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T05:07:21Z", "updated_at": "2021-06-03T05:07:21Z", "author_association": "OWNER", "body": "A problem with this is that if you're using `--query` you likely want ALL of the results - at the moment the only Datasette output type that can stream everything is `.csv` and plugin formats can't handle full streams, see #1062 and #1177.\r\n\r\nSo there's not much point implementing this unless we first make plugins able to add custom streaming formats.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1062#issuecomment-853566011", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1062", "id": 853566011, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2NjAxMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T05:07:42Z", "updated_at": "2021-06-03T05:07:42Z", "author_association": "OWNER", "body": "Implementing this would make #1356 a whole lot more interesting.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732674148, "label": "Refactor .csv to be an output renderer - and teach register_output_renderer to stream all rows"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-853566337", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853566337, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2NjMzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T05:08:32Z", "updated_at": "2021-06-03T05:08:32Z", "author_association": "OWNER", "body": "Also relevant: CSV streaming for canned queries in #526 - even better if we could stream ANY SQL query.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/526#issuecomment-853567413", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/526", "id": 853567413, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2NzQxMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T05:11:27Z", "updated_at": "2021-06-03T05:11:27Z", "author_association": "OWNER", "body": "Another potential way to implement this would be to hold the SQLite connection open and execute the full query there.\r\n\r\nI've avoided this in the past due to concerns of resource exhaustion - if multiple requests attempt this at the same time all of the connections in the pool will become tied up and the site will be unable to respond to further requests.\r\n\r\nBut... now that Datasette has authentication there's the possibility of making this feature only available to specific authenticated users - the `--root` user for example. Which avoids the danger while unlocking a super-useful feature.\r\n\r\nNot to mention people who are running Datasette privately on their own laptop, or the proposed `--query` CLI feature in #1356.", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 459882902, "label": "Stream all results for arbitrary SQL and canned queries"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/264#issuecomment-853567861", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/264", "id": 853567861, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MzU2Nzg2MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-03T05:12:21Z", "updated_at": "2021-06-03T05:12:21Z", "author_association": "OWNER", "body": "I think this is more likely to happen in Datasette than in sqlite-utils - see https://github.com/simonw/datasette/issues/1356 for thoughts on this.", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 907642546, "label": "Supporting additional output formats, like GeoJSON"}, "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} {"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-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-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/datasette/issues/1356#issuecomment-853895159", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 853895159, "node_id": "MDEyOklzc3VlQ29tbWVudDg1Mzg5NTE1OQ==", "user": {"value": 25778, "label": "eyeseast"}, "created_at": "2021-06-03T14:03:59Z", "updated_at": "2021-06-03T14:03:59Z", "author_association": "CONTRIBUTOR", "body": "(Putting thoughts here to keep the conversation in one place.)\r\n\r\nI think using datasette for this use-case is the right approach. I usually have both datasette and sqlite-utils installed in the same project, and that's where I'm trying out queries, so it probably makes the most sense to have datasette also manage the output (and maybe the input, too).\r\n\r\nIt seems like both `--get` and `--query` could work better as subcommands, rather than options, if you're looking at building out a full CLI experience in datasette. It would give a cleaner separation in what you're trying to do and let each have its own dedicated options. So something like this:\r\n\r\n```sh\r\n# run an arbitrary query\r\ndatasette query covid.db \"select * from ny_times_us_counties limit 1\" --format yaml\r\n\r\n# run a canned query\r\ndatasette get covid.db some-canned-query --format yaml\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": 910092577, "label": "Research: syntactic sugar for using --get with SQL queries, maybe \"datasette query\""}, "performed_via_github_app": null}