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

Use glob match for dictionary keys #58

Open
mrzv opened this issue Dec 22, 2023 · 2 comments
Open

Use glob match for dictionary keys #58

mrzv opened this issue Dec 22, 2023 · 2 comments

Comments

@mrzv
Copy link

mrzv commented Dec 22, 2023

Suppose I have a database with the following layout:

A/
  meta.json
  data.json
B/
  meta.json
  data.json
C/
  ...

Then suppose I try to read all the metadata via:

DDB.at('*/meta').read()

This will return the contents of only one of the meta.json, what I'd like is the dictionary of all of them indexed by 'A', 'B', 'C', .... In other words, I'd like the glob wildcard match to be used as keys, not the last component of the path.

Is it possible to add such functionality?

P.S. I realize that it's possible to reorganize the database into something like:

meta/
    A.json
    B.json
    C.json
data/
    A.json
    B.json
    C.json

But I think that's less flexible.

@mkrd
Copy link
Owner

mkrd commented Dec 25, 2023

Hi! I can look into that in the next few days! You could also put all the data into a single json file, which would also increase the speed since it wouldn’t have to read multiple files. But I guess you have some requirement such that they need to be separate?

@mrzv
Copy link
Author

mrzv commented Dec 25, 2023

It's a way to avoid unnecessary locking and conflicts. And thanks for looking into it!

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

2 participants