{"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-749723557", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 749723557, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTcyMzU1Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-22T19:08:27Z", "updated_at": "2020-12-22T19:08:27Z", "author_association": "OWNER", "body": "I'm going to have the `.add_database()` method select the name used in the path, de-duping against any existing names. It will then set database.name to that so that the database has access to its own name.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-748356492", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 748356492, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM1NjQ5Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-18T22:49:32Z", "updated_at": "2020-12-22T01:13:05Z", "author_association": "OWNER", "body": "There's some messy code that needs fixing here. The `datasette.databases` dictionary right now has a key that corresponds to the `/_internal` URL in the path, and a value that's a `Database()` object. BUT... the `Database()` object doesn't know what its key is.\r\n\r\nWhile fixing this I should fix the issue where Datasette gets confused by multiple databases with the same stem: https://github.com/simonw/datasette/issues/509", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-749176936", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 749176936, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTE3NjkzNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-21T20:18:15Z", "updated_at": "2020-12-21T20:18:15Z", "author_association": "OWNER", "body": "Fun query:\r\n```sql\r\nselect table_name, group_concat(name, ', ') from columns group by database_name, table_name\r\n```\r\nhttps://latest.datasette.io/_internal?sql=select+table_name%2C+group_concat%28name%2C+%27%2C+%27%29+from+columns+group+by+database_name%2C+table_name", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-749170608", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 749170608, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTE3MDYwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-21T20:01:47Z", "updated_at": "2020-12-21T20:01:47Z", "author_association": "OWNER", "body": "I removed that `MEMORY` object() in dcdfb2c301341d45b66683e3e3be72f9c7585b2f", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-748397998", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 748397998, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM5Nzk5OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-19T01:28:18Z", "updated_at": "2020-12-19T01:28:18Z", "author_association": "OWNER", "body": "`datasette-graphql` returns an error due to this issue:\r\n\r\n\"GraphiQL_and_fixtures__compound_three_primary_keys__1_001_rows\"\r\n\r\nOn the console:\r\n```\r\nINFO: 127.0.0.1:63116 - \"POST /graphql/_internal HTTP/1.1\" 500 Internal Server Error\r\nTraceback (most recent call last):\r\n File \"/Users/simon/.local/share/virtualenvs/datasette-AWNrQs95/lib/python3.8/site-packages/promise/promise.py\", line 844, in handle_future_result\r\n resolve(future.result())\r\n File \"/Users/simon/.local/share/virtualenvs/datasette-AWNrQs95/lib/python3.8/site-packages/datasette_graphql/utils.py\", line 603, in resolve_table\r\n data, _, _ = await view.data(\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/views/table.py\", line 304, in data\r\n db = self.ds.databases[database]\r\ngraphql.error.located_error.GraphQLLocatedError: ':memory:c6dd5abe1a757a7de00d99b699175bd33d9a575f05b5751bf856b8656fb07edd'\r\n```\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-748368660", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 748368660, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM2ODY2MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-18T23:18:04Z", "updated_at": "2020-12-19T01:12:00Z", "author_association": "OWNER", "body": "A `Database` should have a `.name` which is unique across the Datasette instance and is used in the URL. The `path` should be optional, only set for file databases. A new `.memory_name` property can be used for shared memory databases.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-748368938", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 748368938, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM2ODkzOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-18T23:19:04Z", "updated_at": "2020-12-18T23:19:04Z", "author_association": "OWNER", "body": "`Database` internal class is documented here: https://docs.datasette.io/en/latest/internals.html#database-class", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-748368384", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 748368384, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM2ODM4NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-18T23:17:00Z", "updated_at": "2020-12-18T23:17:00Z", "author_association": "OWNER", "body": "Here's the commit where I added it. https://github.com/simonw/datasette/commit/9743e1d91b5f0a2b3c1c0bd6ffce8739341f43c4 - I didn't yet have the `.add_database()` mechanism. Today the `MEMORY` object bit is no longer needed.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1155#issuecomment-748367922", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1155", "id": 748367922, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM2NzkyMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-18T23:15:24Z", "updated_at": "2020-12-18T23:15:24Z", "author_association": "OWNER", "body": "The code for building up that `.databases` dictionary is a bit convoluted. Here's the code that adds a `:memory:` database if the user specified `--memory` OR if there are no files to be attached:\r\n\r\nhttps://github.com/simonw/datasette/blob/ebc7aa287c99fe6114b79aeab8efb8d4489a6182/datasette/app.py#L221-L241\r\n\r\nI'm not sure why I wrote it this way, instead of just calling `.add_database(\":memory:\", Database(..., is_memory=True)`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 771216293, "label": "Better internal database_name for _internal database"}, "performed_via_github_app": null}