id,node_id,number,state,locked,title,user,body,created_at,updated_at,closed_at,merged_at,merge_commit_sha,assignee,milestone,draft,head,base,author_association,repo,url,merged_by,auto_merge 347179081,MDExOlB1bGxSZXF1ZXN0MzQ3MTc5MDgx,644,closed,0,Validate metadata json on startup,6025893,"This PR adds a sanity check which builds up a marshmallow schema on-the-fly based on the structure of the database(s) on startup and then validates the metadata json against it. In case of invalid data, this will raise with a descriptive error e.g: ``` marshmallow.exceptions.ValidationError: {'databases': {'fixtures': {'tables': {'not_a_table': ['Unknown field.']}}}} ``` Closes #260 --- This was intended to be fairly self-contained, but then while I was working on it, I hit some problems getting the tests to pass in the context of the test suite as a whole. My tests passed in isolation, but then failed while doing a full test suite run. That's when the worms started coming out of the can :bug: After some sleuthing, it turned out this was essentially the result of several issues intersecting: * There are certain events in the application lifecycle where the metadata schema can be modified after it is loaded e.g: https://github.com/simonw/datasette/blob/a562f2965552fb2dbbbd74df245c9965ee23d886/datasette/app.py#L299-L320 This means that sometimes what goes in isn't always exactly what comes out when you call `/-/metadata`. * Because the test fixtures use session scope for performance reasons if one unit test performs an action which mutates the metadata, that can impact on other unit tests which run after it using the same fixture. * Because the `self._metadata` property was being set with a simple assignment `self._metadata = metadata`, that created an object reference to the test fixture data, so operating on `self._metadata` was actually modifying the test fixture `METADATA` meaning that depending on when it was loaded in the test suite lifecycle, `METADATA` had different content, which was somewhat unexpected. As such, I've added some band-aids in 3552024 and 6859fd8: * Switching the metadata object to a `deepcopy` of the input prevents us directly mutating the input fixture. * I've switched some of the tests to use a fixture with function scope instead of session scope so we're working on a clean copy that hasn't been mutated by other tests where necessary but keeping session scope in most cases for performance. * I haven't really addressed the fact that sometimes the metadata object gets mutated in place, so the object that is served from `/-/metadata` isn't necessarily always exactly the same as the file you fed into it on init. I'm not sure how much of a problem that is. The way the tests were written makes me think it was unexpected, but getting into it feels like too much scope creep for this PR so its probably best addressed as another issue.",2019-11-30T00:32:15Z,2021-07-28T17:58:45Z,2021-07-28T17:58:45Z,,e71b642474d54f986bc8857346103d8a10d84e6d,,,0,6859fd8c5eef26f397aa949dc4edf3747e8ab0a5,a562f2965552fb2dbbbd74df245c9965ee23d886,CONTRIBUTOR,107914493,https://github.com/simonw/datasette/pull/644,, 577953727,MDExOlB1bGxSZXF1ZXN0NTc3OTUzNzI3,5,open,0,WIP: Add Gmail takeout mbox import,306240,"WIP This PR adds the ability to import emails from a Gmail mbox export from Google Takeout. This is my first PR to a datasette/dogsheep repo. I've tested this on my personal Google Takeout mbox with ~520,000 emails going back to 2004. This took around ~20 minutes to process. To provide some feedback on the progress of the import I added the ""rich"" python module. I'm happy to remove that if adding a dependency is discouraged. However, I think it makes a nice addition to give feedback on the progress of a long import. Do we want to log emails that have errors when trying to import them? Dealing with encodings with emails is a bit tricky. I'm very open to feedback on how to deal with those better. As well as any other feedback for improvements.",2021-02-22T21:30:40Z,2021-07-28T07:18:56Z,,,65182811d59451299e75f09b4366bb221bc32b20,,,0,a3de045eba0fae4b309da21aa3119102b0efc576,e54e544427f1cc3ea8189f0e95f54046301a8645,FIRST_TIME_CONTRIBUTOR,206649770,https://github.com/dogsheep/google-takeout-to-sqlite/pull/5,, 673872974,MDExOlB1bGxSZXF1ZXN0NjczODcyOTc0,7,open,0,Add instagram-to-sqlite,36654812,"The tool covers only chat imports at the time of opening this PR but I'm planning to import everything else that I feel inquisitive about ref: https://github.com/gavindsouza/instagram-to-sqlite",2021-06-19T12:26:16Z,2021-07-28T07:58:59Z,,,66e9828db4a8ddc4049ab9932e1304288e571821,,,0,4e4c6baf41778071a960d288b0ef02bd01cb6376,92c6bb77629feeed661c7b8d9183a11367de39e0,FIRST_TIME_CONTRIBUTOR,214746582,https://github.com/dogsheep/dogsheep.github.io/pull/7,,