{"html_url": "https://github.com/simonw/datasette/issues/509#issuecomment-502393573", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/509", "id": 502393573, "node_id": "MDEyOklzc3VlQ29tbWVudDUwMjM5MzU3Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-06-15T19:32:56Z", "updated_at": "2019-06-15T19:32:56Z", "author_association": "OWNER", "body": "Experimental exploratory patch:\r\n```diff\r\ndiff --git a/datasette/app.py b/datasette/app.py\r\nindex 2ef7da4..ca51866 100644\r\n--- a/datasette/app.py\r\n+++ b/datasette/app.py\r\n@@ -164,8 +164,10 @@ class Datasette:\r\n is_memory = True\r\n is_mutable = path not in self.immutables\r\n db = Database(self, path, is_mutable=is_mutable, is_memory=is_memory)\r\n+ i = 1\r\n if db.name in self.databases:\r\n- raise Exception(\"Multiple files with same stem: {}\".format(db.name))\r\n+ db.stem = db.name + \"-\" + str(i)\r\n+ i += 1\r\n self.databases[db.name] = db\r\n self.cache_headers = cache_headers\r\n self.cors = cors\r\ndiff --git a/datasette/database.py b/datasette/database.py\r\nindex e491577..75c8681 100644\r\n--- a/datasette/database.py\r\n+++ b/datasette/database.py\r\n@@ -14,6 +14,8 @@ from .inspect import inspect_hash\r\n \r\n \r\n class Database:\r\n+ stem = None\r\n+\r\n def __init__(self, ds, path=None, is_mutable=False, is_memory=False):\r\n self.ds = ds\r\n self.path = path\r\n@@ -73,6 +75,8 @@ class Database:\r\n def name(self):\r\n if self.is_memory:\r\n return \":memory:\"\r\n+ elif self.stem:\r\n+ return self.stem\r\n else:\r\n return Path(self.path).stem\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": 456568880, "label": "Support opening multiple databases with the same stem"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/509#issuecomment-748356637", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/509", "id": 748356637, "node_id": "MDEyOklzc3VlQ29tbWVudDc0ODM1NjYzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-18T22:50:03Z", "updated_at": "2020-12-18T22:50:03Z", "author_association": "OWNER", "body": "Related problem caused by the new `_schemas` database - if a user attempts to open their own `_schemas.db` file it will fail. I'd like to open and mount that as `/_schemas_` instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 456568880, "label": "Support opening multiple databases with the same stem"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/509#issuecomment-749738241", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/509", "id": 749738241, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTczODI0MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-22T19:38:14Z", "updated_at": "2020-12-22T19:38:14Z", "author_association": "OWNER", "body": "I'm fixing this in #1155.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 456568880, "label": "Support opening multiple databases with the same stem"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/509#issuecomment-749749948", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/509", "id": 749749948, "node_id": "MDEyOklzc3VlQ29tbWVudDc0OTc0OTk0OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-12-22T20:03:10Z", "updated_at": "2020-12-22T20:03:10Z", "author_association": "OWNER", "body": "If you open multiple files with the same filename, e.g. like this:\r\n\r\n datasette fixtures.db templates/fixtures.db plugins/fixtures.db\r\n\r\nYou'll now get this:\r\n\r\n\"Datasette__fixtures__fixtures_2__fixtures_3\"\r\n", "reactions": "{\"total_count\": 1, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 1, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 456568880, "label": "Support opening multiple databases with the same stem"}, "performed_via_github_app": null}