Fix multiple dimension query bug
Introduced by testing multiple dimensions not part of the same dimension set. Will revise help to text to indicate that isn't supported -- we end up pruning more than expected. No bueno! Change-Id: I58961861aa183eacab394aa803a6294fed493d70
This commit is contained in:
parent
f3810193bf
commit
6e26e2df9c
@ -75,7 +75,9 @@ def main():
|
|||||||
help_text = """
|
help_text = """
|
||||||
Dimension key/value pairs to delete, only works with -m (name)
|
Dimension key/value pairs to delete, only works with -m (name)
|
||||||
argument. Syntax is the same as the monasca command:
|
argument. Syntax is the same as the monasca command:
|
||||||
-d 'region=dev02,hostname=dev02-keystone-001'
|
-d 'region=dev02,hostname=dev02-keystone-001'. Note that
|
||||||
|
multiple dimensions are supported -- but only if part of
|
||||||
|
a common dimension set (not multiple dimension sets).
|
||||||
"""
|
"""
|
||||||
parser.add_argument('-d', '--dimensions', required=False,
|
parser.add_argument('-d', '--dimensions', required=False,
|
||||||
help=help_text)
|
help=help_text)
|
||||||
@ -224,12 +226,19 @@ def get_dimensions_sql(dimensions):
|
|||||||
kv = pair.split('=')
|
kv = pair.split('=')
|
||||||
if first_time:
|
if first_time:
|
||||||
sql += " ( "
|
sql += " ( "
|
||||||
else:
|
else:
|
||||||
sql += " or "
|
sql += " or "
|
||||||
sql += " (name = '%s' and value = '%s')" % (kv[0], kv[1])
|
sql += " (name = '%s' and value = '%s')" % (kv[0], kv[1])
|
||||||
first_time = False
|
first_time = False
|
||||||
|
|
||||||
sql += ") group by dimension_set_id)"
|
|
||||||
|
sql += """
|
||||||
|
) group by
|
||||||
|
dimension_set_id
|
||||||
|
having
|
||||||
|
count(*) = %d)
|
||||||
|
""" % len(pairs)
|
||||||
|
|
||||||
return sql
|
return sql
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user