{"html_url": "https://github.com/simonw/datasette/issues/1681#issuecomment-1075438684", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1681", "id": 1075438684, "node_id": "IC_kwDOBm6k_c5AGeRc", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-22T17:45:50Z", "updated_at": "2022-03-22T17:49:09Z", "author_association": "OWNER", "body": "I would expect this to break against SQL views that include calculated columns though - something like this:\r\n\r\n```sql\r\ncreate view this_will_break as select pk + 1 as pk_plus_one, 0.5 as score from searchable;\r\n```\r\nConfirmed: the filter interface for that view plain doesn't work for any comparison against that table - except for `score > 0` since `0` is converted to an integer. `0.1` breaks though because it doesn't get converted as it doesn't match `.isdigit()`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1177101697, "label": "Potential bug in numeric handling where_clause for filters"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1681#issuecomment-1075437598", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1681", "id": 1075437598, "node_id": "IC_kwDOBm6k_c5AGeAe", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-22T17:44:42Z", "updated_at": "2022-03-22T17:45:04Z", "author_association": "OWNER", "body": "My hunch is that this mechanism doesn't actually do anything useful at all, because of the type conversion that automatically happens for data from tables based on the column type affinities, see:\r\n- #1671\r\n\r\nSo either remove the `self.numeric` type conversion bit entirely, or prove that it is necessary and upgrade it to be able to handle floating point values too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1177101697, "label": "Potential bug in numeric handling where_clause for filters"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1671#issuecomment-1075435185", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1671", "id": 1075435185, "node_id": "IC_kwDOBm6k_c5AGdax", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-22T17:42:09Z", "updated_at": "2022-03-22T17:42:09Z", "author_association": "OWNER", "body": "Also made me realize that this query:\r\n```sql\r\nselect * from sortable where sortable > :p0\r\n```\r\nOnly works here thanks to the column affinity thing kicking in too: https://latest.datasette.io/fixtures?sql=select+*+from+sortable+where+sortable+%3E+%3Ap0&p0=70", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1174655187, "label": "Filters fail to work correctly against calculated numeric columns returned by SQL views because type affinity rules do not apply"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1671#issuecomment-1075432283", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1671", "id": 1075432283, "node_id": "IC_kwDOBm6k_c5AGctb", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-22T17:39:04Z", "updated_at": "2022-03-22T17:43:12Z", "author_association": "OWNER", "body": "Note that Datasette does already have special logic to convert parameters to integers for numeric comparisons like `>`:\r\n\r\nhttps://github.com/simonw/datasette/blob/c4c9dbd0386e46d2bf199f0ed34e4895c98cb78c/datasette/filters.py#L203-L212\r\n\r\nThough... it looks like there's a bug in that? It doesn't account for `float` values - `\"3.5\".isdigit()` return `False` - probably for the best, because `int(3.5)` would break that value anyway.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1174655187, "label": "Filters fail to work correctly against calculated numeric columns returned by SQL views because type affinity rules do not apply"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1671#issuecomment-1075428030", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1671", "id": 1075428030, "node_id": "IC_kwDOBm6k_c5AGbq-", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-22T17:34:30Z", "updated_at": "2022-03-22T17:34:30Z", "author_association": "OWNER", "body": "No, I think I need to use `cast` - I can't think of any way to ask SQLite \"for this query, what types are the columns that will come back from it?\"\r\n\r\nEven the details from the `explain` trick explored in #1293 don't seem to come back with column type information: https://latest.datasette.io/fixtures?sql=explain+select+pk%2C+text1%2C+text2%2C+[name+with+.+and+spaces]+from+searchable_view+where+%22pk%22+%3D+%3Ap0&p0=1", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1174655187, "label": "Filters fail to work correctly against calculated numeric columns returned by SQL views because type affinity rules do not apply"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1671#issuecomment-1075425513", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1671", "id": 1075425513, "node_id": "IC_kwDOBm6k_c5AGbDp", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-22T17:31:53Z", "updated_at": "2022-03-22T17:31:53Z", "author_association": "OWNER", "body": "The alternative to using `cast` here would be for Datasette to convert the `\"1\"` to a `1` in Python code before passing it as a param.\r\n\r\nThis feels a bit neater to me, but I still then need to solve the problem of how to identify the \"type\" of a column that I want to use in a query.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1174655187, "label": "Filters fail to work correctly against calculated numeric columns returned by SQL views because type affinity rules do not apply"}, "performed_via_github_app": null}