home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 501516797

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/25#issuecomment-501516797 https://api.github.com/repos/simonw/sqlite-utils/issues/25 501516797 MDEyOklzc3VlQ29tbWVudDUwMTUxNjc5Nw== 9599 2019-06-13T01:46:36Z 2019-06-13T01:47:35Z OWNER Maybe `foreign_keys` could even optionally just be a list of columns - it could then attempt to detect the related tables based on some rules-of-thumb and raise an error if there's no obvious candidate. Rules: * If the column name ends in `_id`, remove that suffix and look for a matching table. * Try for a table which is the column name without the `_id` suffix with an `s` appended to it * Try for a table that's the exact match for the column name If none of these rules match, raise an error. So the above example could be further simplified to: ```python db["usages"].insert_all( usages_to_insert, foreign_keys=["line_id", "definition_id"] ) ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 449848803  
Powered by Datasette · Queries took 0.956ms