Skip to content

Improve the error message for optional key quals validation in Steampipe tables where we have anyof key quals instead of required or optional #4459

@ParthaI

Description

@ParthaI

For instance, in the aws_ecr_image_scan_finding table, the key column configuration is as follows:

KeyColumns: []*plugin.KeyColumn{
    {Name: "repository_name", Require: plugin.Required},
    {Name: "image_tag", Require: plugin.AnyOf},
    {Name: "image_digest", Require: plugin.AnyOf},
},

Here, repository_name is a required qualifier, and either image_tag or image_digest is sufficient to make the API call.

Issue with Error Message:
When no any of optional key quals(image_tag or image_digest) are provided in the query, for example select * from aws_ecr_image_scan_finding where repository_name = 'test';
I receive the following error:

Error: rpc error: code = Internal desc = aws: rpc error: code = Internal desc = 'List' call for table 'aws_ecr_image_scan_finding' is missing 2 required quals: 
    column:'image_tag' operator: =
    column:'image_digest' operator: =

The error message incorrectly implies that both image_tag and image_digest are required, when in reality, any one of them is sufficient.

However, the table functionality works as expected. If we include either of the columns (image_tag or image_digest), such as in the query select * from aws_ecr_image_scan_finding where repository_name = 'test' and image_tag = 'latest', it executes successfully.

Metadata

Metadata

Labels

staleNo recent activity has been detected on this issue/PR and it will be closed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions