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

How to use montydb with an existing SQLite database? #78

Open
Andrew-S-Rosen opened this issue Jun 13, 2023 · 2 comments
Open

How to use montydb with an existing SQLite database? #78

Andrew-S-Rosen opened this issue Jun 13, 2023 · 2 comments
Labels
feature New feature or request

Comments

@Andrew-S-Rosen
Copy link

Andrew-S-Rosen commented Jun 13, 2023

I have an existing SQLite database on disk (dispatcher_db.sqlite) and was hoping that I could use montydb to make it possible for me to interact with it in Python as if it were a Mongo database.

It wasn't clear from the README how one might (or might not!) be able to do this. Would you mind providing some insight? Thank you!!

@davidlatwe
Copy link
Owner

Hi @arosen93 👋🏼
This is interesting. But I'm afraid that's not gonna work. 😢

Because montydb uses a SQLite database as a key-value database, here's the command for table creation (or see here):

CREATE TABLE [{}](
    k text NOT NULL,
    v text NOT NULL,
    PRIMARY KEY(k)
);

As you can see, it only has two columns, and if I remember correctly, the value it stores is BSON encoded binary blob. So unless your existing database happens to store data in the same manner, it won't work.

Would be great to have this supported though, might does the trick with a thin mapping/schema layer that wraps around the existing database... Anyway, I am not working on this project for quite a while, cannot say for sure when this will happen, but pull-request is always welcome. 😊

@davidlatwe davidlatwe added the feature New feature or request label Jun 14, 2023
@Andrew-S-Rosen
Copy link
Author

Thank you so much for the reply! Mainly, this is helpful just to know that I can stop trying to see what I'm doing wrong :) I unfortunately don't know enough about SQLite to help with a PR (hence why I was trying montydb to make it more Mongo-like!), but maybe someone will feel inclined to give it a go. Thanks again!

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

No branches or pull requests

2 participants