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

in-memory use #67

Open
dineshbvadhia opened this issue Mar 28, 2017 · 7 comments
Open

in-memory use #67

dineshbvadhia opened this issue Mar 28, 2017 · 7 comments
Assignees

Comments

@dineshbvadhia
Copy link

A sqlitedict db is created and saved to disk eg.

with SqliteDict('mydb'), flag='c') as db:

db.close()

How can you now use 'mydb' in-memory using the sqlite :memory option with sqlitedict?

@Digenis
Copy link
Contributor

Digenis commented Apr 1, 2017

@dineshbvadhia, what is your use case?

@dineshbvadhia
Copy link
Author

To use the data stored in sqlitedict in-memory for performance reasons. The in-memory db will be read-only.

@Digenis
Copy link
Contributor

Digenis commented Apr 1, 2017

What advantages does this offer compared to a regular dict?
What do you mean by "read-only db"?

@dineshbvadhia
Copy link
Author

Are you saying sqlitedict operates in-memory already just like a regular dict?

@Digenis
Copy link
Contributor

Digenis commented Apr 1, 2017

No.
I'm asking why would you want to use sqlitedict in memory
instead of a plain old dict which is much faster and doesn't even need a package.

@dineshbvadhia
Copy link
Author

Will a regular dict support scalability for say 10m to 100m key:value pairs?

@Digenis
Copy link
Contributor

Digenis commented Apr 1, 2017

In regards to memory usage, it's not easy to answer
but I wouldn't expect improvements.
Perhaps you'd want to look into some other technology, like redis.

In regards to speed,
a plain dict is least tens of times faster
than sqlitedict.

Try benchmarking it.
Use as a db filename the :memory: magic string
(yes, the sqlite module has a magic string
and sqlitedict passes it directly as an argument)
This answers your original inquiry – just use SqliteDict(':memory:')
@tmylk, @piskvorky, do you consider this a a bug or a feature?

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

3 participants