-
Notifications
You must be signed in to change notification settings - Fork 131
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
SqliteDict read-only mode should not create table #127
Comments
Hm, interesting question. I have no preference either way – how did this come up for you? What's your motivation, use-case where this makes a difference? CC @mpenkov thoughts? |
Yeah, I think it wouldn't be a bad idea, because it's quite unexpected to modify something by opening it for reading. I think the expected behavior in the above case would be something like a ValueError being raised if the table does not exist. |
I would like to keep things fairly consistent with how things work right now. Raising an exception would be a new workflow. I think it would be reasonable for
|
The use case is somewhat bespoke but IMO not unreasonable. I am using SqliteDict to store user account data and I am bolting on an authentication workflow onto this now. The table name is basically the username and the dict is all the user account data for that user. In the authentication workflow the auth service checks the
The problem right now is that in step 3 the auth service will populate the db with random username that people are trying to login as. Valid or invalid. |
Thanks, that makes sense. How about a separate table (not DB) with valid usernames? …As long as you can keep it in sync with the corresponding user tables (atomic operations).
Isn't that what happens now? I don't follow. |
Per my example it does not look like This is however unrelated to the issue here with the implicit table create. |
The current behavior of SqliteDict is to always create the table it should operate on. Would a PR be accepted to change this behavior, for mode='r', to not to create a table?
The behavior in sqlitedict right now is as follows:
The text was updated successfully, but these errors were encountered: