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, https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501517535,https://api.github.com/repos/simonw/sqlite-utils/issues/25,501517535,MDEyOklzc3VlQ29tbWVudDUwMTUxNzUzNQ==,9599,2019-06-13T01:50:34Z,2019-06-13T01:50:34Z,OWNER,"If I'm going to do this then I should make the `other_table` and `other_column` arguments optional here too: https://github.com/simonw/sqlite-utils/blob/2fed87da6ea990d295672e4db2c8ae97b787913e/sqlite_utils/cli.py#L201-L215","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449848803, https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501548097,https://api.github.com/repos/simonw/sqlite-utils/issues/25,501548097,MDEyOklzc3VlQ29tbWVudDUwMTU0ODA5Nw==,9599,2019-06-13T04:54:33Z,2019-06-13T04:54:33Z,OWNER,"Still need to add this mechanism to `.create_table()` - this code here is all that needs to be modified - it needs to learn to deal with the alternative syntax for foreign keys and guess the missing data if necessary: https://github.com/simonw/sqlite-utils/blob/d645032cfa4edbccd0542eecdddca29edf9f7b07/sqlite_utils/db.py#L115-L119","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449848803, https://github.com/simonw/sqlite-utils/issues/25#issuecomment-501548676,https://api.github.com/repos/simonw/sqlite-utils/issues/25,501548676,MDEyOklzc3VlQ29tbWVudDUwMTU0ODY3Ng==,9599,2019-06-13T04:58:12Z,2019-06-13T04:58:12Z,OWNER,"I'm going to reuse the `ForeignKey` named tuple here: https://github.com/simonw/sqlite-utils/blob/d645032cfa4edbccd0542eecdddca29edf9f7b07/sqlite_utils/db.py#L17-L19","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449848803,