issue_comments: 1079384771
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/sqlite-utils/issues/420#issuecomment-1079384771 | https://api.github.com/repos/simonw/sqlite-utils/issues/420 | 1079384771 | IC_kwDOCGYnMM5AVhrD | 9599 | 2022-03-25T19:51:34Z | 2022-03-25T19:53:01Z | OWNER | This works: ``` % sqlite-utils insert dogs.db dogs dogs.json --convert ' import random print("seeding") random.seed(10) print(random.random()) def convert(row): global random print(row) row["random_score"] = random.random() ' seeding 0.5714025946899135 {'id': 1, 'name': 'Cleo'} {'id': 2, 'name': 'Pancakes'} {'id': 3, 'name': 'New dog'} (sqlite-utils) sqlite-utils % sqlite-utils rows dogs.db dogs [{"id": 1, "name": "Cleo", "random_score": 0.4288890546751146}, {"id": 2, "name": "Pancakes", "random_score": 0.5780913011344704}, {"id": 3, "name": "New dog", "random_score": 0.20609823213950174}] ``` Having to use `global random` inside the function is frustrating but apparently necessary. https://stackoverflow.com/a/56552138/6083 | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | 1178546862 |