{"html_url": "https://github.com/simonw/datasette/issues/1356#issuecomment-1017016553", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 1017016553, "node_id": "IC_kwDOBm6k_c48nnDp", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-20T01:06:37Z", "updated_at": "2022-01-20T01:06:37Z", "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\nI figured out a neat pattern for streaming JSON arrays in this TIL: https://til.simonwillison.net/python/output-json-array-streaming", "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-855282466", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1356", "id": 855282466, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTI4MjQ2Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-05T19:05:06Z", "updated_at": "2021-06-05T19:05:06Z", "author_association": "OWNER", "body": "Yeah that's a good point. I avoided making them sub-commands because `datasette serve` already supports the multitude of other arguments they also need... but actually that was just me being lazy - I can easily share arguments between multiple functions like I do in `sqlite-utils` itself: https://github.com/simonw/sqlite-utils/blob/d1a372b3006e6cf7d2017b3ddc484bf5c033e45d/sqlite_utils/cli.py#L46", "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-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} {"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/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/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-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-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-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-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}