id,node_id,number,state,locked,title,user,user_label,body,created_at,updated_at,closed_at,merged_at,merge_commit_sha,assignee,assignee_label,milestone,milestone_label,draft,head,base,author_association,repo,repo_label,url,merged_by,merged_by_label,auto_merge 510235909,MDExOlB1bGxSZXF1ZXN0NTEwMjM1OTA5,189,closed,0,Allow iterables other than Lists in m2m records,35681,adamwolf,"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,sqlite-utils,https://github.com/simonw/sqlite-utils/pull/189,,, 510956134,MDExOlB1bGxSZXF1ZXN0NTEwOTU2MTM0,190,closed,0,Progress bar for sqlite-utils insert command,9599,simonw,Refs #173,2020-10-27T18:08:53Z,2020-10-27T18:16:03Z,2020-10-27T18:16:03Z,2020-10-27T18:16:03Z,f99a23652910b03ac4669bbbb35a9b484451aabb,,,,,0,62d678122a251812cd650845705ca7b9efcef86d,c7e5dd64513c0ec2b2df4c51c8df924c282417f9,OWNER,140912432,sqlite-utils,https://github.com/simonw/sqlite-utils/pull/190,,, 511005542,MDExOlB1bGxSZXF1ZXN0NTExMDA1NTQy,1056,closed,0,"Radical new colour scheme and base styles, courtesy of @natbat",9599,simonw,,2020-10-27T19:31:48Z,2020-10-27T19:39:57Z,2020-10-27T19:39:56Z,2020-10-27T19:39:56Z,e5f5034bcdc71e4bc62a6a155ca60eb41910c335,,,6026070,0.51,0,a7b2aabd5148c0ee382b583de68a4f0538f7dfb1,26bb4a268127da2c38f4241abe45444b2a6f7874,OWNER,107914493,datasette,https://github.com/simonw/datasette/pull/1056,,,