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

new 0.8 version for sqlite connection with '?mode=ro' not working, Error can't open database #585

Open
Pythonbeginer2014 opened this issue Mar 1, 2024 · 0 comments

Comments

@Pythonbeginer2014
Copy link

Pythonbeginer2014 commented Mar 1, 2024

from contextlib import asynccontextmanager
from databases import Database


@asynccontextmanager
async def async_sqlite_conn(db_name):
    database = Database(f'sqlite+aiosqlite:///example.db?mode=ro', uri=True)
    try:
        await database.connect()
        yield database
    finally:
        await database.disconnect()

when call this function and query data, get error " can't open database"

Thanks ,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant