From 3e1c4a0b31aff762553f5e69f682379a910e255b Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Mon, 30 Oct 2023 12:38:57 -0500 Subject: [PATCH 1/2] fix(python): unmatched paren and influxql syntax: - Remove unmatched closing paren. - Remove quotes from InfluxQL duration. Durations aren't strings. If using SQL, the interval expression ('10 minutes') would be a string. --- .../components/steps/python/ExecuteAggregateQuerySql.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx b/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx index 8a6e260bb9..41507883f4 100644 --- a/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx +++ b/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx @@ -21,14 +21,14 @@ export const ExecuteAggregateQuerySql = (props: OwnProps) => { const sqlSnippet = `SELECT mean(count) FROM 'census' -WHERE time > now() - '10m'` +WHERE time > now() - 10m` const querySnippet = `query = """SELECT mean(count) FROM 'census' -WHERE time > now() - '10m'""" +WHERE time > now() - 10m""" # Execute the query -table = client.query(query=query, database="${bucket}", language='influxql') ) +table = client.query(query=query, database="${bucket}", language="influxql") # Convert to dataframe df = table.to_pandas().sort_values(by="time") From a25cec63857d4c243d64f9c9b781ea46660a4b00 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Mon, 30 Oct 2023 12:54:00 -0500 Subject: [PATCH 2/2] fix(python): Double quote table in influxql syntax: - When quoting the table (measurement) name, use double quotes. Single quotes don't work. --- .../components/steps/python/ExecuteAggregateQuerySql.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx b/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx index 41507883f4..565cb27ead 100644 --- a/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx +++ b/src/homepageExperience/components/steps/python/ExecuteAggregateQuerySql.tsx @@ -20,11 +20,11 @@ export const ExecuteAggregateQuerySql = (props: OwnProps) => { const {bucket} = props const sqlSnippet = `SELECT mean(count) -FROM 'census' +FROM "census" WHERE time > now() - 10m` const querySnippet = `query = """SELECT mean(count) -FROM 'census' +FROM "census" WHERE time > now() - 10m""" # Execute the query