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

add the ability for retention policy context in cli with use command #7708

Merged
merged 2 commits into from
Dec 20, 2016

Conversation

corylanou
Copy link
Contributor

@corylanou corylanou commented Dec 8, 2016

fixes #3188

example usage:

> create database foo
> show retention policies on foo
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        true

> create retention policy bar on foo duration 1h replication 1
> show retention policies on foo
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        true
bar     1h0m0s   1h0m0s             1        false

> use foo
Using database foo
> insert cpu,context=foo value=1
> select * from cpu
name: cpu
time                context value
----                ------- -----
1482248174482948380 foo     1

> use foo.bar
Using database foo
Using retention policy bar
> insert cpu,context=bar value=2
> select * from cpu
name: cpu
time                context value
----                ------- -----
1482248211927258844 bar     2

> settings
Setting           Value
--------          --------
Host              localhost:8086
Username
Database          foo
RetentionPolicy   bar
Pretty            false
Format            column
Write Consistency all
Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
Required only if applicable

You can erase any checkboxes below this note if they are not applicable to your Pull Request.

@corylanou corylanou mentioned this pull request Dec 8, 2016
4 tasks
Copy link
Contributor

@e-dard e-dard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one nit but LGTM 👍

for _, result := range response.Results {
for _, row := range result.Series {
for _, values := range row.Values {
for i, v := range values {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can make this a bit shorter:

for i := 1; i < len(values); i++ {
	if values[i] == rp {
		return true
	}
}

@corylanou corylanou merged commit e883053 into master Dec 20, 2016
@corylanou corylanou deleted the cjl-3188-cli-rp-context branch December 20, 2016 16:06
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

Successfully merging this pull request may close these issues.

[CLI feature request] USE retention policy for queries
2 participants