{"html_url": "https://github.com/simonw/sqlite-utils/issues/415#issuecomment-1073468996", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/415", "id": 1073468996, "node_id": "IC_kwDOCGYnMM4_-9ZE", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T04:14:42Z", "updated_at": "2022-03-21T04:14:42Z", "author_association": "OWNER", "body": "I can fix this like so:\r\n```\r\n% sqlite-utils convert demo.db demo foo '{\"foo\": \"bar\"}' --multi --dry-run\r\nabc\r\n --- becomes:\r\n{\"foo\": \"bar\"}\r\n\r\nWould affect 1 row\r\n```\r\nDiff is this:\r\n```diff\r\ndiff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py\r\nindex 0cf0468..b2a0440 100644\r\n--- a/sqlite_utils/cli.py\r\n+++ b/sqlite_utils/cli.py\r\n@@ -2676,7 +2676,10 @@ def convert(\r\n raise click.ClickException(str(e))\r\n if dry_run:\r\n # Pull first 20 values for first column and preview them\r\n- db.conn.create_function(\"preview_transform\", 1, lambda v: fn(v) if v else v)\r\n+ preview = lambda v: fn(v) if v else v\r\n+ if multi:\r\n+ preview = lambda v: json.dumps(fn(v), default=repr) if v else v\r\n+ db.conn.create_function(\"preview_transform\", 1, preview)\r\n sql = \"\"\"\r\n select\r\n [{column}] as value,\r\n```", "reactions": "{\"total_count\": 1, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 1, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1171599874, "label": "Convert with `--multi` and `--dry-run` flag does not work"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/415#issuecomment-1073463375", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/415", "id": 1073463375, "node_id": "IC_kwDOCGYnMM4_-8BP", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T04:02:36Z", "updated_at": "2022-03-21T04:02:36Z", "author_association": "OWNER", "body": "Thanks for the really clear steps to reproduce!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1171599874, "label": "Convert with `--multi` and `--dry-run` flag does not work"}, "performed_via_github_app": null}