Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: python onboarding corrections #6776

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ type OwnProps = {
export const ExecuteAggregateQuerySql = (props: OwnProps) => {
const {bucket} = props

const sqlSnippet = `SELECT mean(count)
FROM 'census'
WHERE time > now() - '10m'`
const sqlSnippet = `SELECT mean(ants) as ant_mean, mean(bees) as bee_mean
FROM census
WHERE time >= now() - 24h`

const querySnippet = `query = """SELECT mean(count)
FROM 'census'
WHERE time > now() - '10m'"""
const querySnippet = `query = """SELECT mean(ants) as ant_mean, mean(bees) as bee_mean
FROM census
WHERE time >= now() - 24h"""

# 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")
Expand All @@ -40,7 +40,7 @@ print(df)
<h1>Execute an Aggregate Query</h1>
<p>
<SafeBlankLink
href="https://docs.influxdata.com/flux/v0.x/function-types/#aggregates"
href="https://docs.influxdata.com/influxdb/cloud-serverless/reference/influxql/functions/aggregates"
onClick={logDocsOpened}
>
Aggregate functions
Expand All @@ -58,7 +58,7 @@ print(df)
<p>
In this example, we use the{' '}
<code className="homepage-wizard--code-highlight">mean()</code> function
to calculate the average value of data points in the last 10 minutes.
to calculate the average value of data points in the last 24 hours.
<br />
<br />
Run the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ export const ExecuteQuerySql = (props: OwnProps) => {
const {bucket} = props

const sqlSnippet = `SELECT *
FROM 'census'
WHERE time >= now() - interval '1 hour'
AND ('bees' IS NOT NULL OR 'ants' IS NOT NULL)`
FROM census
WHERE time >= now() - interval '1 hour'`

const query = `query = """SELECT *
FROM 'census'
WHERE time >= now() - interval '24 hours'
AND ('bees' IS NOT NULL OR 'ants' IS NOT NULL)"""
FROM census
WHERE time >= now() - interval '24 hours'"""

# Execute the query
table = client.query(query=query, database="${bucket}", language='sql') )
table = client.query(query=query, database="${bucket}", language='sql')

# Convert to dataframe
df = table.to_pandas().sort_values(by="time")
Expand Down
Loading