All Products
Search
Document Center

Sample Data

Last Updated: Jul 28, 2020

This topic provides the sample data that you can download and explains how to import data to a database. This helps you obtain detailed information about the InfluxQL query language. The sample data is referenced in “Data exploration”, “Schema exploration”, and “InfluxQL functions” topics.

Create a database

Log on to the Alibaba Cloud Management Console and create a database named NOAA_water_database.

Download and write data

In the command-line interface (CLI), run the following command to download a text file that contains data in the line protocol format:

  1. curl https://gist.githubusercontent.com/Maihj/5ee8f25aa025671be49e56a1329db38e/raw/4132e06b4b149db692107387250bdaebf10643e5/NOAA_data.txt -o NOAA_data.txt

In the CLI, run the following command to write the downloaded data to TSDB for InfluxDB®:

  1. influx -ssl -username <Username> -password <Password> -host <Domain name> -port 3242 -import -path=NOAA_data.txt -precision=s -database=NOAA_water_database

Perform query tests

  1. $ influx -ssl -username <Username> -password <Password> -host <Domain name> -port 3242 -precision rfc3339 -database NOAA_water_database
  2. Connected to https://<Domain name>:3242 version 1.7.x
  3. InfluxDB shell 1.7.x
  4. >

View all the measurements in the sample data. The sample data consists of five measurements.

  1. > SHOW measurements
  2. name: measurements
  3. ------------------
  4. name
  5. average_temperature
  6. h2o_feet
  7. h2o_pH
  8. h2o_quality
  9. h2o_temperature

Calculate the number of non-null field values for the water_level field key in the h2o_feet measurement.

  1. > SELECT COUNT("water_level") FROM h2o_feet
  2. name: h2o_feet
  3. --------------
  4. time count
  5. 1970-01-01T00:00:00Z 15258

Query the first five reported values in the h2o_feet measurement.

  1. > SELECT * FROM h2o_feet LIMIT 5
  2. name: h2o_feet
  3. --------------
  4. time level description location water_level
  5. 2015-08-18T00:00:00Z below 3 feet santa_monica 2.064
  6. 2015-08-18T00:00:00Z between 6 and 9 feet coyote_creek 8.12
  7. 2015-08-18T00:06:00Z between 6 and 9 feet coyote_creek 8.005
  8. 2015-08-18T00:06:00Z below 3 feet santa_monica 2.116
  9. 2015-08-18T00:12:00Z between 6 and 9 feet coyote_creek 7.887

Data sources and considerations

The sample data is published by the Center for Operational Oceanographic Products and Services (CO-OPS) of National Oceanic and Atmospheric Administration (NOAA). The sample data includes 15,258 reported values for water levels (ft). The values are collected at the Santa Monica (ID 9410840) and Coyote Creek, California (ID 9414575) sites over the period from August 18, 2015 to September 18, 2015. The values were updated every 6 seconds.

Note that the average_temperature, h2o_pH, h2o_quality, and h2o_temperature measurements contain simulated data. The simulated data is used to explain the queries in the “Schema exploration” topic.


InfluxDB® is a trademark registered by InfluxData, which is not affiliated with, and does not endorse, TSDB for InfluxDB®.