issue_comments: 502393573
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/509#issuecomment-502393573 | https://api.github.com/repos/simonw/datasette/issues/509 | 502393573 | MDEyOklzc3VlQ29tbWVudDUwMjM5MzU3Mw== | 9599 | 2019-06-15T19:32:56Z | 2019-06-15T19:32:56Z | OWNER | Experimental exploratory patch: ```diff diff --git a/datasette/app.py b/datasette/app.py index 2ef7da4..ca51866 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -164,8 +164,10 @@ class Datasette: is_memory = True is_mutable = path not in self.immutables db = Database(self, path, is_mutable=is_mutable, is_memory=is_memory) + i = 1 if db.name in self.databases: - raise Exception("Multiple files with same stem: {}".format(db.name)) + db.stem = db.name + "-" + str(i) + i += 1 self.databases[db.name] = db self.cache_headers = cache_headers self.cors = cors diff --git a/datasette/database.py b/datasette/database.py index e491577..75c8681 100644 --- a/datasette/database.py +++ b/datasette/database.py @@ -14,6 +14,8 @@ from .inspect import inspect_hash class Database: + stem = None + def __init__(self, ds, path=None, is_mutable=False, is_memory=False): self.ds = ds self.path = path @@ -73,6 +75,8 @@ class Database: def name(self): if self.is_memory: return ":memory:" + elif self.stem: + return self.stem else: return Path(self.path).stem ``` | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | 456568880 |