Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datasette.add_memory_database() method #1247

Closed
simonw opened this issue Mar 1, 2021 · 2 comments
Closed

datasette.add_memory_database() method #1247

simonw opened this issue Mar 1, 2021 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Mar 1, 2021

I just wrote this code:

ds = Datasette([], memory=True)
db = ds.add_database(Database(ds, memory_name="test_json_array"))

It would be nice if you didn't have to separately instantiate a database object here.

@simonw
Copy link
Owner Author

simonw commented Mar 1, 2021

A couple of options:

datasette.add_memory_database("test_json_array")
# or make that first argument to add_database() optional and support:
datasette.add_database(memory_name="test_json_array")

@simonw
Copy link
Owner Author

simonw commented Mar 1, 2021

I like the .add_memory_database() option. I also like that it makes it more obvious that this is a capability of Datasette, since I'm excited to see more plugins, features and tests that take advantage of it.

@simonw simonw changed the title Shortcut for adding a new memory database datasette.add_memory_database() method Mar 1, 2021
@simonw simonw closed this as completed in 7c87532 Mar 1, 2021
simonw added a commit that referenced this issue Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant