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/842#issuecomment-649000075 | https://api.github.com/repos/simonw/datasette/issues/842 | 649000075 | MDEyOklzc3VlQ29tbWVudDY0OTAwMDA3NQ== | 9599 | 2020-06-24T18:46:36Z | 2020-06-24T18:47:37Z | OWNER | Another magic parameter that would be useful would be `_random`. Consider https://github.com/simonw/datasette-auth-tokens/issues/1 for example - I'd like to be able to provide a writable canned query which can create new authentication tokens in the database, but ideally it would automatically populate a secure random secret for each one. Maybe `_random_chars_128` to create a 128 character long random string (using `os.urandom(64).hex()`). This would be the first example of a magic parameter where part of the parameter name is used to configure the resulting value. Maybe neater to separate that with a different character? Unfortunately `_random_chars:128` wouldn't work because these parameters are used in a SQLite query where `:` has special meaning: `insert into blah (secret) values (:_random_chars:128)` wouldn't make sense. Actually this is already supported by the proposed design - `_random_chars_128` would become `random("chars_128")` so the `random()` function could split off the 128 itself. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638212085 | |
https://github.com/simonw/datasette/issues/842#issuecomment-649014757 | https://api.github.com/repos/simonw/datasette/issues/842 | 649014757 | MDEyOklzc3VlQ29tbWVudDY0OTAxNDc1Nw== | 9599 | 2020-06-24T19:15:46Z | 2020-06-24T19:31:52Z | OWNER | I'm building this documentation-first - here's the documentation so far: https://github.com/simonw/datasette/blob/6fc8bd9c473f4a25e0a076f24c7e5a9b2f353bb8/docs/sql_queries.rst#magic-parameters | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
638212085 |