-
Notifications
You must be signed in to change notification settings - Fork 31
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
MontyStore
cannot be used with a pre-existing local DB
#796
Comments
Thanks for reporting @arosen93 ; I agree this should work. Looking at the montdby docs, it's not totally clear to me what the right way to connect to a pre-existing database is within
Once we know how this needs to look within |
This is the traceback: In [1]: from montydb import set_storage, MontyClient
...:
...: set_storage("dispatcher_db.sqlite", storage="sqlite") # required, to set sqlit
...: e as engine
...: client = MontyClient("dispatcher_db.sqlite")
---------------------------------------------------------------------------
FileExistsError Traceback (most recent call last)
Cell In[1], line 3
1 from montydb import set_storage, MontyClient
----> 3 set_storage("dispatcher_db.sqlite", storage="sqlite") # required, to set sqlite as engine
4 client = MontyClient("dispatcher_db.sqlite")
File ~/software/miniconda/envs/quacc/lib/python3.9/site-packages/montydb/configure.py:232, in set_storage(repository, storage, mongo_version, use_bson, **kwargs)
229 setup = os.path.join(repository, _storage_ident_fname)
231 if not os.path.isdir(repository):
--> 232 os.makedirs(repository)
234 with open(setup, "w") as fp:
235 fp.write(storage)
File ~/software/miniconda/envs/quacc/lib/python3.9/os.py:225, in makedirs(name, mode, exist_ok)
223 return
224 try:
--> 225 mkdir(name, mode)
226 except OSError:
227 # Cannot rely on checking for EEXIST, since the operating system
228 # could give priority to other errors like EACCES or EROFS
229 if not exist_ok or not path.isdir(name):
FileExistsError: [Errno 17] File exists: 'dispatcher_db.sqlite' I'm not sure how it works in Linking: davidlatwe/montydb#78 |
@rkingsbury: Oops, that's because I can't follow instructions. Your suggestion does work! But note it's the directory to the SQLite database and not the SQLite file. Your code snippet from their README does indeed create a valid Edit: Thought using the directory fixed it but it returns a store with 0 documents. Will report back once I have more. |
@munrojm, @rkingsbury: Okay, we got the answer from the source themself. As described in davidlatwe/montydb#78, In the linked PR, I clarified the docstring which will close this issue. |
MontyStore
relies on a DB written to the local disk. However, it'd be nice to be able to useMontyStore
to read a pre-existing SQLite database (for instance) in a more Mongo-friendly way. I tried that below without luck.That returns
I'm happy to share a sample SQLite database if required for reproducing the error.
The text was updated successfully, but these errors were encountered: