github
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/datasette/issues/1863#issuecomment-1302790013 | https://api.github.com/repos/simonw/datasette/issues/1863 | 1302790013 | IC_kwDOBm6k_c5Npv99 | 9599 | 2022-11-03T23:32:30Z | 2022-11-03T23:32:30Z | OWNER | I'm not going to allow updates to primary keys. If you need to do that, you can instead delete the record and then insert a new one with the new primary keys you wanted - or maybe use a custom SQL query. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1425029242 | |
https://github.com/simonw/datasette/issues/1863#issuecomment-1302785086 | https://api.github.com/repos/simonw/datasette/issues/1863 | 1302785086 | IC_kwDOBm6k_c5Npuw- | 9599 | 2022-11-03T23:24:33Z | 2022-11-03T23:24:56Z | OWNER | Thinking more about validation: I'm considering if this should validate that columns which are defined as SQLite foreign keys are being updated to values that exist in those other tables. I like the sound of this. It seems like a sensible default behaviour for Datasette. And it fits with the fact that Datasette treats foreign keys specially elsewhere in the interface. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1425029242 | |
https://github.com/simonw/datasette/issues/1863#issuecomment-1302760549 | https://api.github.com/repos/simonw/datasette/issues/1863 | 1302760549 | IC_kwDOBm6k_c5Npoxl | 9599 | 2022-11-03T22:43:04Z | 2022-11-03T23:21:31Z | OWNER | The `id=(int, ...)` thing is weird, but is apparently Pydantic syntax for a required field? https://cs.github.com/starlite-api/starlite/blob/28ddc847c4cb072f0d5d21a9ecd5259711f12ec9/docs/usage/11-data-transfer-objects.md#L161 confirms: > 1. For required fields use a tuple of type + ellipsis, for example `(str, ...)`. > 2. For optional fields use a tuple of type + `None`, for example `(str, None)` > 3. To set a default value use a tuple of type + default value, for example `(str, "Hello World")` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1425029242 | |
https://github.com/simonw/datasette/issues/1863#issuecomment-1302760382 | https://api.github.com/repos/simonw/datasette/issues/1863 | 1302760382 | IC_kwDOBm6k_c5Npou- | 9599 | 2022-11-03T22:42:47Z | 2022-11-03T22:42:47Z | OWNER | ```python print(create_model('document', id=(int, ...), title=(str, None)).schema_json(indent=2)) ``` ```json { "title": "document", "type": "object", "properties": { "id": { "title": "Id", "type": "integer" }, "title": { "title": "Title", "type": "string" } }, "required": [ "id" ] } ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1425029242 | |
https://github.com/simonw/datasette/issues/1863#issuecomment-1302759174 | https://api.github.com/repos/simonw/datasette/issues/1863 | 1302759174 | IC_kwDOBm6k_c5NpocG | 9599 | 2022-11-03T22:40:47Z | 2022-11-03T22:40:47Z | OWNER | I'm considering Pydantic for this, see: - https://github.com/simonw/datasette/issues/1882#issuecomment-1302716350 In particular the `create_model()` method: https://pydantic-docs.helpmanual.io/usage/models/#dynamic-model-creation This would give me good validation. It would also, weirdly, give me the ability to output JSON schema. Maybe I could have this as the JSON schema for a row? `/db/table/-/json-schema` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1425029242 |