home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 1539018912

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/530#issuecomment-1539018912 https://api.github.com/repos/simonw/sqlite-utils/issues/530 1539018912 IC_kwDOCGYnMM5bu5Cg 9599 2023-05-08T20:39:00Z 2023-05-08T20:39:00Z OWNER I think the natural place to add these in the Python library API would be https://sqlite-utils.datasette.io/en/stable/python-api.html#adding-foreign-key-constraints - maybe something like this: ```python db["books"].add_foreign_key("author_id", "authors", "id", on_delete=RESTRICT) ``` Then for the CLI tool could be added to https://sqlite-utils.datasette.io/en/stable/cli-reference.html#add-foreign-key ``` sqlite-utils add-foreign-key my.db books author_id authors id --on-update SET_NULL ``` I wouldn't support these for the other methods of adding foreign keys - `foreign_keys(...)` for the various `.insert()` etc methods and the `add_foreign_keys(...)` bulk menthod. {"total_count": 1, "+1": 0, "-1": 0, "laugh": 1, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 1595340692  
Powered by Datasette · Queries took 0.956ms