Skip to content

How to retrieve value of a key without having to write the entire key? #16334

Answered by jmhbnz
dev-vaayen asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Anand11Yash - Thanks for your question. etcd as a key value store doesn't have complex query capabilities like a traditional relational database, so you need to structure your keys in a way that makes querying feasible.

The approach you are taking with etcdctl get --prefix and then further filter with additional tools like grep makes sense to me. Perhaps just extend your prefix to also include ColomboSchool so one less grep iteration is required.

etcdctl get --prefix "/schools/ColomboSchool" | grep "22"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jmhbnz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants