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

All key quals are given (including optional) if required key quals are missing in query #159

Closed
cbruno10 opened this issue Jul 29, 2021 · 0 comments
Assignees

Comments

@cbruno10
Copy link
Contributor

Describe the bug
For instance, if I have:

func tableAwsCloudtrailEventsListKeyColumns() []*plugin.KeyColumn {
	return []*plugin.KeyColumn{
		// CloudWatch fields
		{Name: "log_group_name"},
		{Name: "log_stream_name", Require: plugin.Optional},
		{Name: "filter", Require: plugin.Optional},
		{Name: "region", Require: plugin.Optional},
		{Name: "timestamp", Operators: []string{">", ">=", "=", "<", "<="}, Require: plugin.Optional},
		// event fields
		{Name: "event_category", Require: plugin.Optional},
		{Name: "event_id", Require: plugin.Optional},
		{Name: "aws_region", Require: plugin.Optional},
		{Name: "source_ip_address", Require: plugin.Optional},
		{Name: "error_code", Require: plugin.Optional},
		{Name: "event_name", Require: plugin.Optional},
		{Name: "read_only", Require: plugin.Optional},
		{Name: "username", Require: plugin.Optional},
		{Name: "user_type", Require: plugin.Optional},
		{Name: "event_source", Require: plugin.Optional},
		{Name: "access_key_id", Require: plugin.Optional},
	}
}

If I run a query not giving log_group_name but pass an optional key qual, I get:

> select * from aws_cloudtrail_trail_event where region = 'us-east-1';
Error: rpc error: code = Internal desc = 'List' call is missing required quals:
column:'log_group_name' operator: =
column:'log_stream_name' operator: =
column:'filter' operator: =
column:'timestamp' operators: >,>=,=,<,<=
column:'event_category' operator: =
column:'event_id' operator: =
column:'aws_region' operator: =
column:'source_ip_address' operator: =
column:'error_code' operator: =
column:'event_name' operator: =
column:'read_only' operator: =
column:'username' operator: =
column:'user_type' operator: =
column:'event_source' operator: =
column:'access_key_id' operator: =

From this message, it seems like all of these are required, not just log_group_name

Steampipe version (steampipe -v)
v0.7.0

To reproduce
Steps to reproduce the behavior (please include relevant code and/or commands).

Expected behavior
Only required key quals are given in the list of missing key quals

Additional context
Add any other context about the problem here.

@kaidaguerre kaidaguerre transferred this issue from turbot/steampipe Aug 2, 2021
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