{"html_url": "https://github.com/simonw/sqlite-utils/issues/42#issuecomment-697037974", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/42", "id": 697037974, "node_id": "MDEyOklzc3VlQ29tbWVudDY5NzAzNzk3NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-22T23:39:31Z", "updated_at": "2020-09-22T23:39:31Z", "author_association": "OWNER", "body": "Documentation for `sqlite-utils extract`: https://sqlite-utils.readthedocs.io/en/latest/cli.html#extracting-columns-into-a-separate-table", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 470345929, "label": "table.extract(...) method and \"sqlite-utils extract\" command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/42#issuecomment-697031174", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/42", "id": 697031174, "node_id": "MDEyOklzc3VlQ29tbWVudDY5NzAzMTE3NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-22T23:16:00Z", "updated_at": "2020-09-22T23:16:00Z", "author_association": "OWNER", "body": "Trying this demo again:\r\n```\r\nwget 'https://raw.githubusercontent.com/wri/global-power-plant-database/master/output_database/global_power_plant_database.csv'\r\nsqlite-utils insert global.db power_plants global_power_plant_database.csv --csv\r\nsqlite-utils extract global.db power_plants country country_long --table countries --rename country_long name\r\n```\r\nIt worked!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 470345929, "label": "table.extract(...) method and \"sqlite-utils extract\" command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/42#issuecomment-697025403", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/42", "id": 697025403, "node_id": "MDEyOklzc3VlQ29tbWVudDY5NzAyNTQwMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-22T22:57:53Z", "updated_at": "2020-09-22T22:57:53Z", "author_association": "OWNER", "body": "The documentation for the `.extract()` method is here: https://sqlite-utils.readthedocs.io/en/latest/python-api.html#extracting-columns-into-a-separate-table", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 470345929, "label": "table.extract(...) method and \"sqlite-utils extract\" command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/42#issuecomment-697019944", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/42", "id": 697019944, "node_id": "MDEyOklzc3VlQ29tbWVudDY5NzAxOTk0NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-22T22:40:00Z", "updated_at": "2020-09-22T22:40:00Z", "author_association": "OWNER", "body": "I tried out the prototype of the CLI on the Global Power Plants data:\r\n```\r\nwget 'https://raw.githubusercontent.com/wri/global-power-plant-database/master/output_database/global_power_plant_database.csv'\r\nsqlite-utils insert global.db power_plants global_power_plant_database.csv --csv\r\nsqlite-utils extract global.db power_plants country country_long\r\n```\r\nThis threw an error because `rowid` columns are not yet supported. I fixed that like so:\r\n```\r\nsqlite-utils transform global.db power_plants --rename rowid id\r\nsqlite-utils extract global.db power_plants country country_long\r\n```\r\nThat worked! But it didn't play great with Datasette, because the resulting extracted table had columns `country` and `country_long` and neither of those are called `name` or `value` or `title`.\r\n\r\nBased on this I need to add `rowid` table support AND I need to implement the proposed `rename=` argument for renaming columns on their way into the new table.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 470345929, "label": "table.extract(...) method and \"sqlite-utils extract\" command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/42#issuecomment-697013681", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/42", "id": 697013681, "node_id": "MDEyOklzc3VlQ29tbWVudDY5NzAxMzY4MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-22T22:22:49Z", "updated_at": "2020-09-22T22:22:49Z", "author_association": "OWNER", "body": "The command-line version of this needs to accept a table and one or more columns, then a `--table` and `--fk-column` option.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 470345929, "label": "table.extract(...) method and \"sqlite-utils extract\" command"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/42#issuecomment-697012111", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/42", "id": 697012111, "node_id": "MDEyOklzc3VlQ29tbWVudDY5NzAxMjExMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-22T22:18:13Z", "updated_at": "2020-09-22T22:18:13Z", "author_association": "OWNER", "body": "Here's how I'm generating the examples for the documentation:\r\n```\r\nIn [2]: import sqlite_utils\r\n\r\nIn [3]: db = sqlite_utils.Database(memory=True)\r\n\r\nIn [4]: db[\"Trees\"].insert({\"id\": 1, \"TreeAddress\": \"52 Vine St\", \"CommonName\":\r\n ...: \"Palm\", \"LatinName\": \"foo\"}, pk=\"id\")\r\nOut[4]: