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

Crashes Datasette on startup if run against an immutable database #6

Closed
simonw opened this issue Aug 15, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Aug 15, 2020

See simonw/latest-datasette-with-all-plugins#3 (comment)

When I fix this I can uncomment this line in that project: https://github.com/simonw/latest-datasette-with-all-plugins/blob/29fe2eb28a6b0a18d63fad178e55f429ef81fd52/plugins.txt#L34

@simonw simonw added the bug Something isn't working label Aug 15, 2020
@simonw
Copy link
Owner Author

simonw commented Aug 15, 2020

Relevant code:

@hookimpl
def startup(datasette):
async def inner():
db = datasette.get_database()
await db.execute_write_fn(create_tables, block=True)
return inner

def create_tables(conn):
db = sqlite_utils.Database(conn)
if not db["saved_queries"].exists():
db["saved_queries"].create(
{"name": str, "sql": str, "author_id": str,}, pk="name"
)

simonw added a commit that referenced this issue Aug 15, 2020
simonw added a commit to simonw/latest-datasette-with-all-plugins that referenced this issue Aug 15, 2020
@simonw simonw closed this as completed Aug 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant