Skip to content

Creating filter for aws_pricing_product using jsonb_build_object is not working #584

@mmaravich

Description

@mmaravich

I am trying to dynamically create the filter for querying the aws_pricing_product table. I was experimenting with ways of creating the filter dynamically and discovered it does not really work.

For example, if I do this, everything works as expected and returns about 21 rows in a second:

select 
	*
from 
	aws_pricing_product
where
	service_code = 'AmazonEC2'
	AND filters = '{"tenancy": "Shared",
	"locationType": "AWS Region",
	"preInstalledSw": "NA",
	"capacitystatus": "Used",
	"instanceType": "r7i.xlarge",
	"regionCode": "us-east-1",
	"operatingSystem": "Linux"}'::jsonb;

But, suppose I want to use the jsonb_build_object function to dynamically build a filter (this example has static values, but I could easily use values from JOINs or subselects, or whatever):

select 
	*
from 
	aws_pricing_product
where
	service_code = 'AmazonEC2'
	AND filters = jsonb_build_object(
		'tenancy' , 'Shared',
		'locationType' , 'AWS Region',
		'preInstalledSw' , 'NA',
		'capacitystatus', 'Used',
		'instanceType' , 'r7i.xlarge',
		'regionCode' , 'us-east-1',
		'operatingSystem', 'Linux'
		)

This query will timeout. If I am reading the debug logs correctly (I am new at trying to troubleshooting), this generates requests that do not contain any filter - and of course that makes for a lot of requests...

Steamppipe version: Steampipe v2.0.1
AWS Plugin version: 1.17.0

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions