SlideShare a Scribd company logo
Katy Farmer
Developer Advocate
@thekatertot
Using the SQL
Datasource in 2.0
InfluxDB . + Flux + SQL (+ you!)
Multiple Datasources
InfluxDB . + Flux + SQL (+ you!)
Multiple Datasources
Why?
• Connect your time series data
with other types of data for
enrichment (and for fun)
• Single responsibility databases
Why?
• Connect your time series data
with other types of data for
enrichment (and for fun)
• Single responsibility databases
© InfluxData. All rights reserved.
Industrial IoT
Relational Data
All sensor metrics (temperature, pressure,
water level,
Time Series Data
Hardware information (model, year, etc.), date
deployed, region, id
© InfluxData. All rights reserved.
Industrial IoT
Relational Data
All sensor metrics (temperature, pressure,
water level,
Time Series Data
Hardware information (model, year, etc.), date
deployed, region, id
© InfluxData. All rights reserved.
Industrial IoT
Relational Data
All sensor metrics (temperature, pressure,
water level,
Time Series Data
Hardware information (model, year, etc.), date
deployed, region, id
© InfluxData. All rights reserved.
User Tracking
Relational Data
Logins, page visits, clicks, duration on page
Time Series Data
Name, email, location, history (browsing,
purchases, etc.)
© InfluxData. All rights reserved.
User Tracking
Relational Data
Logins, page visits, clicks, duration on page
Time Series Data
Name, email, location, history (browsing,
purchases, etc.)
© InfluxData. All rights reserved.
User Tracking
Relational Data
Logins, page visits, clicks, duration on page
Time Series Data
Name, email, location, history (browsing,
purchases, etc.)
Example:
Robots
(Industrial IoT)
Each robot has:
❏ ID
❏ name
❏ model
❏ created_at (timestamp)
Example:
Robots
(Industrial IoT)
Each robot has:
❏ ID
❏ name
❏ model
❏ created_at (timestamp)
Example:
Robots
(Industrial IoT)
Each robot has:
❏ ID
❏ name
❏ model
❏ created_at (timestamp)
Example:
Robots
(Industrial IoT)
Each robot has:
❏ ID
❏ name
❏ model
❏ created_at (timestamp)
Example:
Robots
(Industrial IoT)
Robot jobs vary. Some measure parts, some
place parts on belts, and others rotate the
parts for inspection. But not all robots
perform the same. Some of them crash.
What is the average CPU usage of each
robot?
Example:
Robots
(Industrial IoT)
Robot jobs vary. Some measure parts, some
place parts on belts, and others rotate the
parts for inspection. But not all robots
perform the same. Some of them crash.
What is the average CPU usage of each
robot?
Example:
Robots
(Industrial IoT)
Robot jobs vary. Some measure parts, some
place parts on belts, and others rotate the
parts for inspection. But not all robots
perform the same. Some of them crash.
What is the average CPU usage of each
robot?
© InfluxData. All rights reserved.
Step : Importing SQL Data with Flux
import "sql"
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
query:"SELECT * FROM mydb;")
© InfluxData. All rights reserved.
Step : Importing SQL Data with Flux
import "sql"
sql.from(
driverName: "postgres",
dataSourceName:
"postgresql://localhost/robots?sslmode=disable",
query:"SELECT * FROM robots;")
© InfluxData. All rights reserved.© InfluxData. All rights reserved.
© InfluxData. All rights reserved.
Step : Write your first Flux query
from(bucket: "robots")
|> range(start: -10d)
|> filter(fn: (r) => r._measurement == "cpu")
|> filter(fn: (r) => r._field == "system_usage")
|> mean()
© InfluxData. All rights reserved.© InfluxData. All rights reserved.
© InfluxData. All rights reserved.
Step : Joining Data Streams
import "sql"
info = sql.from(
driverName: "postgres",
dataSourceName: "postgresql://localhost/robots?sslmode=disable",
query:"SELECT * FROM robots;")
cpu = from(bucket: "robots")
|> range(start: -10d)
|> filter(fn: (r) => r._measurement == "cpu")
|> filter(fn: (r) => r._field == "system_usage")
|> mean()
join(tables: {cpu:cpu, info:info}, on: ["id"])
© InfluxData. All rights reserved.© InfluxData. All rights reserved.
© InfluxData. All rights reserved.
Step : Storing Results
sql.to() requirements:
❏ Data in the stream must have same column names as the
SQL DB
❏ Drop any columns that won’t be stored
❏ Remember your schema! Any rules (not null, unique, etc.)
must be followed or the write will not succeed.
© InfluxData. All rights reserved.
import "sql"
info = sql.from(
driverName: "postgres",
dataSourceName: "postgresql://localhost/robots?sslmode=disable",
query:"SELECT * FROM robots;")
cpu = from(bucket: "robots")
|> range(start: -10d)
|> filter(fn: (r) => r._measurement == "cpu")
|> filter(fn: (r) => r._field == "system_usage")
|> mean()
join(tables: {cpu:cpu, info:info}, on: ["id"])
|> keep(columns: ["id", "_value", "created_at"])
|> sql.to(
driverName: "postgres",
dataSourceName: "postgresql://localhost/robots?sslmode=disable",
table: "averages")
© InfluxData. All rights reserved.
Things I did wrong
© InfluxData. All rights reserved.
Things I did wrong
© InfluxData. All rights reserved.
Questions
Thank you!
katy@influxdata.com
@thekatertot
© InfluxData. All rights reserved.
Questions
Thank you!
katy@influxdata.com
@thekatertot
© InfluxData. All rights reserved.
Questions
Thank you!
katy@influxdata.com
@thekatertot
© InfluxData. All rights reserved.
Questions
Thank you!
katy@influxdata.com
@thekatertot
© InfluxData. All rights reserved.
Questions
Thank you!
katy@influxdata.com
@thekatertot

More Related Content

What's hot (20)

PDF
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
InfluxData
 
PDF
Advanced kapacitor
InfluxData
 
PDF
Observability of InfluxDB IOx: Tracing, Metrics and System Tables
InfluxData
 
PDF
Extending Flux to Support Other Databases and Data Stores | Adam Anthony | In...
InfluxData
 
PDF
Introduction to Flux and Functional Data Scripting
InfluxData
 
PDF
Virtual training Intro to Kapacitor
InfluxData
 
PDF
How to Build a Telegraf Plugin by Noah Crowley
InfluxData
 
PDF
Catalogs - Turning a Set of Parquet Files into a Data Set
InfluxData
 
PDF
OPTIMIZING THE TICK STACK
InfluxData
 
PDF
WRITING QUERIES (INFLUXQL AND TICK)
InfluxData
 
PDF
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
InfluxData
 
PPTX
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
InfluxData
 
PDF
Setting up InfluxData for IoT
InfluxData
 
PPTX
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
InfluxData
 
PDF
Virtual training Intro to InfluxDB & Telegraf
InfluxData
 
PDF
Intro to Kapacitor for Alerting and Anomaly Detection
InfluxData
 
PDF
Write your own telegraf plugin
InfluxData
 
PDF
Introduction to InfluxDB
Jorn Jambers
 
PDF
InfluxData Architecture for IoT | Noah Crowley | InfluxData
InfluxData
 
PDF
Kapacitor Stream Processing
InfluxData
 
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
InfluxData
 
Advanced kapacitor
InfluxData
 
Observability of InfluxDB IOx: Tracing, Metrics and System Tables
InfluxData
 
Extending Flux to Support Other Databases and Data Stores | Adam Anthony | In...
InfluxData
 
Introduction to Flux and Functional Data Scripting
InfluxData
 
Virtual training Intro to Kapacitor
InfluxData
 
How to Build a Telegraf Plugin by Noah Crowley
InfluxData
 
Catalogs - Turning a Set of Parquet Files into a Data Set
InfluxData
 
OPTIMIZING THE TICK STACK
InfluxData
 
WRITING QUERIES (INFLUXQL AND TICK)
InfluxData
 
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
InfluxData
 
Scaling Prometheus Metrics in Kubernetes with Telegraf | Chris Goller | Influ...
InfluxData
 
Setting up InfluxData for IoT
InfluxData
 
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
InfluxData
 
Virtual training Intro to InfluxDB & Telegraf
InfluxData
 
Intro to Kapacitor for Alerting and Anomaly Detection
InfluxData
 
Write your own telegraf plugin
InfluxData
 
Introduction to InfluxDB
Jorn Jambers
 
InfluxData Architecture for IoT | Noah Crowley | InfluxData
InfluxData
 
Kapacitor Stream Processing
InfluxData
 

Similar to Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData (20)

PPTX
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
InfluxData
 
PPTX
Anais Dotis-Georgiou & Faith Chikwekwe [InfluxData] | Top 10 Hurdles for Flux...
InfluxData
 
PDF
Flux QL - Nexgen Management of Time Series Inspired by JS
Ivo Andreev
 
PDF
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
InfluxData
 
PDF
Virtual training intro to InfluxDB - June 2021
InfluxData
 
PDF
Russ Savage [Ngrok] | InfluxDB QuickStart | InfluxDays NA 2021
InfluxData
 
PDF
Time Series to Vectors: Leveraging InfluxDB and Milvus for Similarity Search
Zilliz
 
PDF
OPTIMIZING THE TICK STACK
InfluxData
 
PDF
Power Your Predictive Analytics with InfluxDB
InfluxData
 
PDF
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
InfluxData
 
PDF
2021 10-13 i ox query processing
Andrew Lamb
 
PDF
Intro to InfluxDB
InfluxData
 
PDF
Using the Open Source OPC-UA Client and Server for Your IIoT Solutions | Jero...
InfluxData
 
PDF
Influxdb and time series data
Marcin Szepczyński
 
PDF
Solving Manufacturing Challenges with Time Series Data.pdf
Suyash Joshi
 
PDF
Build an Edge-to-Cloud Solution with the MING Stack
InfluxData
 
PDF
Intro to Time Series
InfluxData
 
PPTX
InfluxDB 1.0 - Optimizing InfluxDB by Sam Dillard
InfluxData
 
PDF
Virtual training optimizing the tick stack
InfluxData
 
PDF
Introduction to influx db
Roberto Gaudenzi
 
Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta
InfluxData
 
Anais Dotis-Georgiou & Faith Chikwekwe [InfluxData] | Top 10 Hurdles for Flux...
InfluxData
 
Flux QL - Nexgen Management of Time Series Inspired by JS
Ivo Andreev
 
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
InfluxData
 
Virtual training intro to InfluxDB - June 2021
InfluxData
 
Russ Savage [Ngrok] | InfluxDB QuickStart | InfluxDays NA 2021
InfluxData
 
Time Series to Vectors: Leveraging InfluxDB and Milvus for Similarity Search
Zilliz
 
OPTIMIZING THE TICK STACK
InfluxData
 
Power Your Predictive Analytics with InfluxDB
InfluxData
 
InfluxDB IOx Tech Talks: Query Processing in InfluxDB IOx
InfluxData
 
2021 10-13 i ox query processing
Andrew Lamb
 
Intro to InfluxDB
InfluxData
 
Using the Open Source OPC-UA Client and Server for Your IIoT Solutions | Jero...
InfluxData
 
Influxdb and time series data
Marcin Szepczyński
 
Solving Manufacturing Challenges with Time Series Data.pdf
Suyash Joshi
 
Build an Edge-to-Cloud Solution with the MING Stack
InfluxData
 
Intro to Time Series
InfluxData
 
InfluxDB 1.0 - Optimizing InfluxDB by Sam Dillard
InfluxData
 
Virtual training optimizing the tick stack
InfluxData
 
Introduction to influx db
Roberto Gaudenzi
 
Ad

More from InfluxData (20)

PPTX
Announcing InfluxDB Clustered
InfluxData
 
PDF
Best Practices for Leveraging the Apache Arrow Ecosystem
InfluxData
 
PDF
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
InfluxData
 
PDF
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
PDF
Meet the Founders: An Open Discussion About Rewriting Using Rust
InfluxData
 
PDF
Introducing InfluxDB Cloud Dedicated
InfluxData
 
PDF
Gain Better Observability with OpenTelemetry and InfluxDB
InfluxData
 
PPTX
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
InfluxData
 
PDF
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
PPTX
Introducing InfluxDB’s New Time Series Database Storage Engine
InfluxData
 
PDF
Start Automating InfluxDB Deployments at the Edge with balena
InfluxData
 
PDF
Understanding InfluxDB’s New Storage Engine
InfluxData
 
PDF
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
InfluxData
 
PPTX
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
InfluxData
 
PDF
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
InfluxData
 
PDF
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
InfluxData
 
PDF
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
PDF
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 
PDF
Paul Dix [InfluxData] The Journey of InfluxDB | InfluxDays 2022
InfluxData
 
PDF
Jay Clifford [InfluxData] | Tips & Tricks for Analyzing IIoT in Real-Time | I...
InfluxData
 
Announcing InfluxDB Clustered
InfluxData
 
Best Practices for Leveraging the Apache Arrow Ecosystem
InfluxData
 
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
InfluxData
 
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
Meet the Founders: An Open Discussion About Rewriting Using Rust
InfluxData
 
Introducing InfluxDB Cloud Dedicated
InfluxData
 
Gain Better Observability with OpenTelemetry and InfluxDB
InfluxData
 
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
InfluxData
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
Introducing InfluxDB’s New Time Series Database Storage Engine
InfluxData
 
Start Automating InfluxDB Deployments at the Edge with balena
InfluxData
 
Understanding InfluxDB’s New Storage Engine
InfluxData
 
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
InfluxData
 
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
InfluxData
 
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
InfluxData
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 
Paul Dix [InfluxData] The Journey of InfluxDB | InfluxDays 2022
InfluxData
 
Jay Clifford [InfluxData] | Tips & Tricks for Analyzing IIoT in Real-Time | I...
InfluxData
 
Ad

Recently uploaded (20)

DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 

Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData

  • 2. InfluxDB . + Flux + SQL (+ you!) Multiple Datasources InfluxDB . + Flux + SQL (+ you!) Multiple Datasources
  • 3. Why? • Connect your time series data with other types of data for enrichment (and for fun) • Single responsibility databases Why? • Connect your time series data with other types of data for enrichment (and for fun) • Single responsibility databases
  • 4. © InfluxData. All rights reserved. Industrial IoT Relational Data All sensor metrics (temperature, pressure, water level, Time Series Data Hardware information (model, year, etc.), date deployed, region, id © InfluxData. All rights reserved. Industrial IoT Relational Data All sensor metrics (temperature, pressure, water level, Time Series Data Hardware information (model, year, etc.), date deployed, region, id © InfluxData. All rights reserved. Industrial IoT Relational Data All sensor metrics (temperature, pressure, water level, Time Series Data Hardware information (model, year, etc.), date deployed, region, id
  • 5. © InfluxData. All rights reserved. User Tracking Relational Data Logins, page visits, clicks, duration on page Time Series Data Name, email, location, history (browsing, purchases, etc.) © InfluxData. All rights reserved. User Tracking Relational Data Logins, page visits, clicks, duration on page Time Series Data Name, email, location, history (browsing, purchases, etc.) © InfluxData. All rights reserved. User Tracking Relational Data Logins, page visits, clicks, duration on page Time Series Data Name, email, location, history (browsing, purchases, etc.)
  • 6. Example: Robots (Industrial IoT) Each robot has: ❏ ID ❏ name ❏ model ❏ created_at (timestamp) Example: Robots (Industrial IoT) Each robot has: ❏ ID ❏ name ❏ model ❏ created_at (timestamp) Example: Robots (Industrial IoT) Each robot has: ❏ ID ❏ name ❏ model ❏ created_at (timestamp) Example: Robots (Industrial IoT) Each robot has: ❏ ID ❏ name ❏ model ❏ created_at (timestamp)
  • 7. Example: Robots (Industrial IoT) Robot jobs vary. Some measure parts, some place parts on belts, and others rotate the parts for inspection. But not all robots perform the same. Some of them crash. What is the average CPU usage of each robot? Example: Robots (Industrial IoT) Robot jobs vary. Some measure parts, some place parts on belts, and others rotate the parts for inspection. But not all robots perform the same. Some of them crash. What is the average CPU usage of each robot? Example: Robots (Industrial IoT) Robot jobs vary. Some measure parts, some place parts on belts, and others rotate the parts for inspection. But not all robots perform the same. Some of them crash. What is the average CPU usage of each robot?
  • 8. © InfluxData. All rights reserved. Step : Importing SQL Data with Flux import "sql" sql.from( driverName: "postgres", dataSourceName: "postgresql://user:password@localhost", query:"SELECT * FROM mydb;")
  • 9. © InfluxData. All rights reserved. Step : Importing SQL Data with Flux import "sql" sql.from( driverName: "postgres", dataSourceName: "postgresql://localhost/robots?sslmode=disable", query:"SELECT * FROM robots;")
  • 10. © InfluxData. All rights reserved.© InfluxData. All rights reserved.
  • 11. © InfluxData. All rights reserved. Step : Write your first Flux query from(bucket: "robots") |> range(start: -10d) |> filter(fn: (r) => r._measurement == "cpu") |> filter(fn: (r) => r._field == "system_usage") |> mean()
  • 12. © InfluxData. All rights reserved.© InfluxData. All rights reserved.
  • 13. © InfluxData. All rights reserved. Step : Joining Data Streams import "sql" info = sql.from( driverName: "postgres", dataSourceName: "postgresql://localhost/robots?sslmode=disable", query:"SELECT * FROM robots;") cpu = from(bucket: "robots") |> range(start: -10d) |> filter(fn: (r) => r._measurement == "cpu") |> filter(fn: (r) => r._field == "system_usage") |> mean() join(tables: {cpu:cpu, info:info}, on: ["id"])
  • 14. © InfluxData. All rights reserved.© InfluxData. All rights reserved.
  • 15. © InfluxData. All rights reserved. Step : Storing Results sql.to() requirements: ❏ Data in the stream must have same column names as the SQL DB ❏ Drop any columns that won’t be stored ❏ Remember your schema! Any rules (not null, unique, etc.) must be followed or the write will not succeed.
  • 16. © InfluxData. All rights reserved. import "sql" info = sql.from( driverName: "postgres", dataSourceName: "postgresql://localhost/robots?sslmode=disable", query:"SELECT * FROM robots;") cpu = from(bucket: "robots") |> range(start: -10d) |> filter(fn: (r) => r._measurement == "cpu") |> filter(fn: (r) => r._field == "system_usage") |> mean() join(tables: {cpu:cpu, info:info}, on: ["id"]) |> keep(columns: ["id", "_value", "created_at"]) |> sql.to( driverName: "postgres", dataSourceName: "postgresql://localhost/robots?sslmode=disable", table: "averages")
  • 17. © InfluxData. All rights reserved. Things I did wrong © InfluxData. All rights reserved. Things I did wrong
  • 18. © InfluxData. All rights reserved. Questions Thank you! katy@influxdata.com @thekatertot © InfluxData. All rights reserved. Questions Thank you! katy@influxdata.com @thekatertot © InfluxData. All rights reserved. Questions Thank you! katy@influxdata.com @thekatertot © InfluxData. All rights reserved. Questions Thank you! katy@influxdata.com @thekatertot © InfluxData. All rights reserved. Questions Thank you! katy@influxdata.com @thekatertot