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

Support wildcard for KV get #1011

Open
AbstractiveNord opened this issue Mar 11, 2024 · 11 comments
Open

Support wildcard for KV get #1011

AbstractiveNord opened this issue Mar 11, 2024 · 11 comments
Labels
proposal Enhancement idea or proposal

Comments

@AbstractiveNord
Copy link

Proposed change

Allow use wildcard, star at least, in get queries.

Use case

Keys, separated by dots, can't be effectively used without wildcards. For now, natscli respond with "nats: invalid key".

Contribution

Yes.

@AbstractiveNord AbstractiveNord added the proposal Enhancement idea or proposal label Mar 11, 2024
@ripienaar
Copy link
Collaborator

What's the use case for this? There are no multi key behaviours in the cli KV feature at the moment those are best used via clients, but if there's a strong use case I can look

@AbstractiveNord
Copy link
Author

What's the use case for this? There are no multi key behaviours in the cli KV feature at the moment those are best used via clients, but if there's a strong use case I can look

I use KV as status storage. Every unit has a key, which interpret a some task on unit. Key is formatted as "unit_id.task_id". That feature needs to query task_id across every unit, query all tasks on specific unit_id, etc.

@ripienaar
Copy link
Collaborator

So what are you doing with the CLI in this scenario?

What you describe sounds like something to handle using client libraries, I am specifically asking what you are trying to achieve the with the CLI.

My concern is adding too much features like this people end up writing bash scripts using the CLI instead of using our programming libraries. The CLI output format is not a contract and there are no guarantees it wont break such code. So hence asking what the CLI use case is here.

@AbstractiveNord
Copy link
Author

So what are you doing with the CLI in this scenario?

What you describe sounds like something to handle using client libraries, I am specifically asking what you are trying to achieve the with the CLI.

My concern is adding too much features like this people end up writing bash scripts using the CLI instead of using our programming libraries. The CLI output format is not a contract and there are no guarantees it wont break such code. So hence asking what the CLI use case is here.

In case of cli usage, I have to check status on tasks manually, using natscli. It's like a maintenance job. I agree with that concern, but I am not sure that feature will cause people to mess around with bash or something like that. Just a rapid option to check part of the key.

@AbstractiveNord
Copy link
Author

So what are you doing with the CLI in this scenario?
What you describe sounds like something to handle using client libraries, I am specifically asking what you are trying to achieve the with the CLI.
My concern is adding too much features like this people end up writing bash scripts using the CLI instead of using our programming libraries. The CLI output format is not a contract and there are no guarantees it wont break such code. So hence asking what the CLI use case is here.

In case of cli usage, I have to check status on tasks manually, using natscli. It's like a maintenance job. I agree with that concern, but I am not sure that feature will cause people to mess around with bash or something like that. Just a rapid option to check part of the key.

Let's say that's some ordering system, and user calls support to check order status. Order is bound to some worker, and you as manager wants just check, which units executed logic on that order, is everything ok. Since worker isn't single, it may cause problems to manually check

  • unit1.order_id
  • unit2.order_id
  • unit3.order_id
  • unit4.order_id
  • unit5.order_id

Instead of nats kv get orders_status "*.order_id"

@ripienaar
Copy link
Collaborator

And what would the display be? A table of key and value thats all?

@AbstractiveNord
Copy link
Author

AbstractiveNord commented Mar 11, 2024

And what would the display be? A table of key and value thats all?

Yes, or just simply loop over the keys, similar to nats stream view command output, because metadata, such as timestamp of the key, may be important.

@ripienaar
Copy link
Collaborator

Well its not that simple, because stream view is paged etc and thats quite a lot.

when you could do nats stream view KV_FOO --subject '$KV.KV_FOO.*.order_id :) Doesnt roll off the figures but I am definitely not building stream view on the CLI for KV.

@AbstractiveNord
Copy link
Author

Well its not that simple, because stream view is paged etc and thats quite a lot.

when you could do nats stream view KV_FOO --subject '$KV.KV_FOO.*.order_id :) Doesnt roll off the figures but I am definitely not building stream view on the CLI for KV.

No need to page that. At least not in my request. Yes, I can use view method, or direct calls, but it's a little bit hacky, not for a managers on support.

@ripienaar
Copy link
Collaborator

For general use and suitabilty to many needs - I would have to page it.

@AbstractiveNord
Copy link
Author

For general use and suitabilty to many needs - I would have to page it.

I got that as not simple, so, well, that's on your discretion.

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

No branches or pull requests

2 participants