{"html_url": "https://github.com/simonw/datasette/issues/427#issuecomment-482864457", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/427", "id": 482864457, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4Mjg2NDQ1Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-13T18:51:44Z", "updated_at": "2019-04-13T18:57:51Z", "author_association": "OWNER", "body": "A facet needs to:\r\n- given a sql query and a list of configs, return a list of buckets\r\n - Know how to generate URLs for selecting and deselecting a filter (along with underlying filter application sql logic)\r\n - Tell if a specific filter is currently selected or not\r\n - Set a time limit and report if it times out\r\n - Generate human readable labels\r\n - In some cases: expand foreign keys - which means they need access to foreign key information - just the name of the table and the name of the column is enough to call `expand_foreign_keys()` (I [moved that](https://github.com/simonw/datasette/commit/274ef43bb7b129ddc2e68805b4f4ff3776fb9503) to the Datasette class to make it easier to access)\r\n- Make suggestions for facets. Let's give it access to the whole table here so it could either run against each column in return and rely with a list of suggestions or it could spot eg a latitude and a longitude column", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 431800286, "label": "New design for facet abstraction, including querystring and metadata.json"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/427#issuecomment-482864837", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/427", "id": 482864837, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4Mjg2NDgzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-13T18:53:43Z", "updated_at": "2019-04-13T18:53:43Z", "author_association": "OWNER", "body": "`TableView.data` is currently the longest, hairiest method in the codebase. It's 775 - 177 = 598 lines of code! Extracting faceting logic should help reduce that quite a bit.\r\n\r\nhttps://github.com/simonw/datasette/blob/274ef43bb7b129ddc2e68805b4f4ff3776fb9503/datasette/views/table.py#L177-L775", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 431800286, "label": "New design for facet abstraction, including querystring and metadata.json"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/427#issuecomment-482865424", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/427", "id": 482865424, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4Mjg2NTQyNA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-13T18:56:25Z", "updated_at": "2019-04-13T19:42:08Z", "author_association": "OWNER", "body": "I think there's a `Facet` base class.\r\n\r\n`class ColumnFacet(Facet):` is the default behaviour we have today\r\n\r\n`class ArrayFacet(Facet):` facet by JSON array\r\n\r\n`class ManyToManyFacet(Facet):` facet by M2M table\r\n\r\n`class DateFacet(Facet):` facet by date\r\n\r\n`class DateTimeFacet(Facet):` facet by datetime\r\n\r\n`class EmojiFacet(Facet):` super-fun demo plugin I have planned\r\n\r\nCould even have a facet against a numerical column which loads the entire set of column values into numpy or pandas and calculates complex statistics facets in memory .\r\n\r\nThere\u2019s actually a lot of potential for Datasette plugins that load several MBs of data and analyze using other Python libraries.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 431800286, "label": "New design for facet abstraction, including querystring and metadata.json"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/429#issuecomment-482766801", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/429", "id": 482766801, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4Mjc2NjgwMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-13T01:56:19Z", "updated_at": "2019-04-13T01:56:19Z", "author_association": "OWNER", "body": "Documentation is here: https://datasette.readthedocs.io/en/latest/json_api.html#special-table-arguments\r\n\r\nDemo:\r\n\r\n* https://latest.datasette.io/fixtures/facetable?_where=state=%22MI%22&_where=city_id=3\r\n* https://latest.datasette.io/fixtures/facetable?_where=city_id%20in%20(select%20id%20from%20facet_cities%20where%20name%20!=%20%22Detroit%22)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 432636432, "label": "?_where=sql-fragment parameter for table views"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/431#issuecomment-482872210", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/431", "id": 482872210, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4Mjg3MjIxMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-13T19:37:57Z", "updated_at": "2019-04-13T19:37:57Z", "author_association": "OWNER", "body": "You should be able to see the reload happening in the console logs:\r\n\r\n\"tmp_\u2014_sqlite3_fixtures_db_\u2014_80\u00d725_and_tmp_\u2014_Python_\u25c2_datasette_--reload_fixtures_db_-p_8052_\u2014_154\u00d757_and_datasette_\u2014_python3_7__usr_local_Cellar_pipenv_2018_11_26_libexec_bin_pipenv_shell_\u25b8_bash_\u2014_147\u00d743\"\r\n\r\nI'm doing some work at the moment to handle mutating files MUCH better - #419 - my goal is to have Datasette work against SQLite files that are being updated out-of-the box, and change the current immutable behaviour to be an option rather than the default.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 432870248, "label": "Datasette doesn't reload when database file changes"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/432#issuecomment-482876432", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/432", "id": 482876432, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4Mjg3NjQzMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-13T20:06:32Z", "updated_at": "2019-04-13T20:06:32Z", "author_association": "OWNER", "body": "This has a bug which isn't being caught by the unit tests (yet) - facet suggestion suggests facets that have already been enabled:\r\n\r\n\"fixtures__facetable__15_rows\"\r\n\r\nThere is also a test failure due to missing plugin hook documentation.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 432893491, "label": "Refactor facets to a class and new plugin, refs #427"}, "performed_via_github_app": null}