Update query hash with parameters applied (#6683)

This allows queries with parameters to run on a schedule since the hash
used to update the query_result will match.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Guido Petri <18634426+guidopetri@users.noreply.github.com>
This commit is contained in:
Eric Radman
2024-01-09 22:46:31 -05:00
committed by GitHub
parent 1b1b9bd98d
commit 4d81c3148d
3 changed files with 29 additions and 4 deletions

View File

@@ -466,6 +466,14 @@ class TestQueryAll(BaseTestCase):
query.update_query_hash()
self.assertEqual(origin_hash, query.query_hash)
def test_update_query_hash_basesql_with_parameters(self):
ds = self.factory.create_data_source(group=self.factory.org.default_group, type="pg")
query = self.factory.create_query(query_text="SELECT {{num}}", data_source=ds)
query.options = {"parameters": [{"type": "number", "name": "num", "value": 5}]}
origin_hash = query.query_hash
query.update_query_hash()
self.assertNotEqual(origin_hash, query.query_hash)
class TestGroup(BaseTestCase):
def test_returns_groups_with_specified_names(self):