{"html_url": "https://github.com/simonw/sqlite-utils/issues/179#issuecomment-699524671", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/179", "id": 699524671, "node_id": "MDEyOklzc3VlQ29tbWVudDY5OTUyNDY3MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-26T17:31:23Z", "updated_at": "2020-09-27T20:31:50Z", "author_association": "OWNER", "body": "SQL query for detecting integers:\r\n```sql\r\nselect\r\n 'contains_non_integer' as result\r\nfrom\r\n mytable\r\nwhere\r\n cast(cast(mycolumn AS INTEGER) AS TEXT) != mycolumn\r\nlimit\r\n 1\r\n```\r\nThis will return a single row with a 1 as soon as it comes across a column that contains a non-integer - so it short circuits quickly on TEXT columns with non-integers in them.\r\n\r\nIf everything in the column is an integer it will scan the whole thing before returning no rows.\r\n\r\nMore extensive demo:\r\n```sql\r\nselect\r\n value,\r\n cast(cast(value AS INTEGER) AS TEXT) = value as is_valid_int\r\nfrom\r\n (\r\n select\r\n '1' as value\r\n union\r\n select\r\n '1.1' as value\r\n union\r\n select\r\n 'dog' as value\r\n union\r\n select\r\n null as value\r\n )\r\n```\r\nhttps://latest.datasette.io/fixtures?sql=select%0D%0A++value%2C%0D%0A++cast%28cast%28value+AS+INTEGER%29+AS+TEXT%29+%3D+value+as+is_valid_int%0D%0Afrom%0D%0A++%28%0D%0A++++select%0D%0A++++++%271%27+as+value%0D%0A++++union%0D%0A++++select%0D%0A++++++%271.1%27+as+value%0D%0A++++union%0D%0A++++select%0D%0A++++++%27dog%27+as+value%0D%0A++++union%0D%0A++++select%0D%0A++++++null+as+value%0D%0A++%29\r\n\r\n\r\nvalue | is_valid_int\r\n-- | --\r\n\u00a0 | \u00a0\r\n1 | 1\r\n1.1 | 0\r\ndog | 0", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 709577625, "label": "sqlite-utils transform/insert --detect-types"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/179#issuecomment-699684535", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/179", "id": 699684535, "node_id": "MDEyOklzc3VlQ29tbWVudDY5OTY4NDUzNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-09-27T20:30:31Z", "updated_at": "2020-09-27T20:30:31Z", "author_association": "OWNER", "body": "This recipe looks like it might be the way to detect floats:\r\n```sql\r\nselect\r\n value,\r\n cast(cast(value AS REAL) AS TEXT) in (value, value || '.0') as is_valid_float\r\nfrom\r\n (\r\n select\r\n '1' as value\r\n union\r\n select\r\n '1.1' as value\r\n union\r\n select\r\n 'dog' as value\r\n union\r\n select\r\n null as value\r\n )\r\n```\r\nDemo: https://latest.datasette.io/fixtures?sql=select%0D%0A++value%2C%0D%0A++cast%28cast%28value+AS+REAL%29+AS+TEXT%29+in+%28value%2C+value+%7C%7C+%27.0%27%29+as+is_valid_float%0D%0Afrom%0D%0A++%28%0D%0A++++select%0D%0A++++++%271%27+as+value%0D%0A++++union%0D%0A++++select%0D%0A++++++%271.1%27+as+value%0D%0A++++union%0D%0A++++select%0D%0A++++++%27dog%27+as+value%0D%0A++++union%0D%0A++++select%0D%0A++++++null+as+value%0D%0A++%29\r\n\r\n\r\nvalue | is_valid_float\r\n-- | --\r\n\u00a0 | \u00a0\r\n1 | 1\r\n1.1 | 1\r\ndog | 0", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 709577625, "label": "sqlite-utils transform/insert --detect-types"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/858#issuecomment-699690034", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/858", "id": 699690034, "node_id": "MDEyOklzc3VlQ29tbWVudDY5OTY5MDAzNA==", "user": {"value": 39445562, "label": "smithdc1"}, "created_at": "2020-09-27T21:23:04Z", "updated_at": "2020-09-27T21:23:04Z", "author_association": "NONE", "body": "Hi Simon,\r\n\r\nThanks so much for all your work on datasette, it's an excellent project and I wish you all the best with it. I particularly enjoyed your talk at the Django London Meetup a short while back. \r\n\r\nI've been trying to publish to Heroku from Windows 10 and I was running into this error. I'm not sure why it can't be run without `shell=True` on Windows but this seems to help. With this change, I am able to publish if I pass in a `name` to the `publish` command. When a `name` is not passed the default of `datasette` is used and therefore this line here fails (as datasette at heroku already exists) and causes the recession error mentioned above.\r\n\r\nhttps://github.com/simonw/datasette/blob/9a6d0dce282e7fb58c5610e24c74098c923abfdc/datasette/publish/heroku.py#L126\r\n\r\nI tried to write a patch for this but I am really struggling with being on Windows (many of the tests seem to fail anyway?), and my lack of knowledge of Mock, so sorry for this. Hope this is of some help. ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 642388564, "label": "publish heroku does not work on Windows 10"}, "performed_via_github_app": null}