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

Do not create tables when in read-only mode #128

Merged
merged 3 commits into from
Jan 9, 2021

Conversation

hholst80
Copy link
Contributor

@hholst80 hholst80 commented Jan 4, 2021

If db was opened with flag='r', check if tablename exists, if not raise RuntimeError.

Closes #127

If db was opened with flag='r', check if tablename exists, if not raise RuntimeError.
sqlitedict.py Show resolved Hide resolved
sqlitedict.py Outdated Show resolved Hide resolved
Update RuntimeError message per @piskvorky's suggestion

Co-authored-by: Radim Řehůřek <me@radimrehurek.com>
@piskvorky piskvorky requested a review from mpenkov January 7, 2021 09:41
@mpenkov mpenkov changed the title Check if tablename exists Do not create tables when in read-only mode Jan 8, 2021
Copy link
Collaborator

@mpenkov mpenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good. Is there a way to unit-test these changes?

Having a test would help us prevent regressions in the future.

Opening a SqliteDict in read-only mode should not
create a new table, only raise RuntimeError.
@hholst80
Copy link
Contributor Author

hholst80 commented Jan 8, 2021

I included a basic test.

@mpenkov mpenkov merged commit 5058a43 into piskvorky:master Jan 9, 2021
@mpenkov
Copy link
Collaborator

mpenkov commented Jan 9, 2021

Good work @hholst80 ! Thank you for your contribution.

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

Successfully merging this pull request may close these issues.

SqliteDict read-only mode should not create table
3 participants