home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 507052051

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/23#issuecomment-507052051 https://api.github.com/repos/simonw/sqlite-utils/issues/23 507052051 MDEyOklzc3VlQ29tbWVudDUwNzA1MjA1MQ== 9599 2019-06-30T17:09:51Z 2019-06-30T17:15:09Z OWNER

Maybe there's a case where we want to be able to insert a row AND add its m2m records in a single operation? Could look something like this:

python db["events"].insert({ "id": 1, "title": "Some event" }, m2m={ "venues": { "id": 4, "venue_name": "Blah", "latitude": 37.77 "longitude": 122.42 } }) The venues key in that dictionary could be a single dictionary or a list of dictionary.

I'm not sure about this though. If the m2m= argument causes the creation of the venues table, how would we pass in extra creation options like pk= for that table?

Maybe some complex nested function mechanism like this?

python db["events"].insert({ "id": 1, "title": "Some event" }, m2m=[db["venues"].upsert({ "id": 4, "venue_name": "Blah", "latitude": 37.77 "longitude": 122.42 }, pk="id")] })

This would require having .insert() and friends return a more interesting object than they do at the moment. They currently return self to support chaining. Changing this would be a backwards-incompatible change and hence would require a major version bump... unless they continued to return self but remembered the last inserted record in a way that could be handled by that m2m= argument.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
449565204  
Powered by Datasette · Queries took 1.102ms · About: github-to-sqlite