home / github / pull_requests

Menu
  • Search all tables
  • GraphQL API

pull_requests: 510235909

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association repo url merged_by auto_merge
510235909 MDExOlB1bGxSZXF1ZXN0NTEwMjM1OTA5 189 closed 0 Allow iterables other than Lists in m2m records 35681 I was playing around with sqlite-utils, creating a Roam Research dogsheep-style importer for Datasette, and ran into a slight snag. I wanted to use a generator to add an order column in an importer. It looked something like: ``` def order_generator(iterable, attr=None): if attr is None: attr = "order" order: int = 0 for i in iterable: i[attr] = order order += 1 yield i ``` When I used this with `insert_all` and other things, it worked fine--but it didn't work as the `records` argument to `m2m`. I dug into it, and sqlite-utils is explicitly checking if the records argument is a list or a tuple. I flipped the check upside down, and now it checks if the argument is a mapping. If it's a mapping, it wraps it in a list, otherwise it leaves it alone. (I get that it might not really make sense to put the order column on the second table. I changed my import schema a bit, and no longer have a real example, but maybe this change still makes sense.) The automated tests still pass, but I did not add any new ones. Let me know what you think! I'm really loving Datasette and its ecosystem; thanks for everything! 2020-10-26T18:47:44Z 2020-10-27T16:28:37Z 2020-10-27T16:24:21Z 2020-10-27T16:24:21Z f045d8559a6d2cb922a2de30fbcc896a4486b82f     0 93230b2acb61635b6d5070ad9c65e7221c63b75a e4f1c7b936981de29823730c5dbef4f4ba7a4286 CONTRIBUTOR 140912432 https://github.com/simonw/sqlite-utils/pull/189    

Links from other tables

  • 1 row from pull_requests_id in labels_pull_requests
Powered by Datasette ยท Queries took 1.247ms