Skip to content

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

Merged
mpenkov merged 3 commits into
piskvorky:masterfrom
hholst80:master
Jan 9, 2021
Merged

Do not create tables when in read-only mode#128
mpenkov merged 3 commits into
piskvorky:masterfrom
hholst80:master

Conversation

@hholst80

@hholst80 hholst80 commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

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.
Comment thread sqlitedict.py
Comment thread sqlitedict.py Outdated
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 Jan 8, 2021

@mpenkov mpenkov left a comment

Copy link
Copy Markdown
Collaborator

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

hholst80 commented Jan 8, 2021

Copy link
Copy Markdown
Contributor Author

I included a basic test.

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

mpenkov commented Jan 9, 2021

Copy link
Copy Markdown
Collaborator

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

3 participants