-
Notifications
You must be signed in to change notification settings - Fork 20
Description
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