All Products
Search
Document Center

Time Series Database:Sample data

Last Updated:Nov 30, 2021

This topic describes how to import data into TSDB for InfluxDB®. To help you get familiar with InfluxQL, this topic also provides sample data available for downloading. The sample data is used in the Schema exploration topic, the Data exploration topic, the Data exploration chapter, and the InfluxQL functions chapter.

Create a database

Use the Alibaba Cloud platform to create a database named NOAA_water_database.

Download and write data

Run the following command in your terminal to download a text file. The text file contains data in the line protocol format:

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

Run the following command in the TSDB for InfluxDB® CLI to import the downloaded data into TSDB for InfluxDB®:

influx -ssl -username <Account name> -password <Password> -host <Network address> -port 3242 -import -path=NOAA_data.txt -precision=s -database=NOAA_water_database

Data query tests

$ influx -ssl -username <Account name> -password <Password> -host <Network address> -port 3242 -precision rfc3339 -database NOAA_water_database
Connected to https://<Network address>:3242 version 1.7.x
InfluxDB shell 1.7.x
>

Query all measurements in the sample data. Five measurements are returned:

> SHOW measurements
name: measurements
------------------
name
average_temperature
h2o_feet
h2o_pH
h2o_quality
h2o_temperature

Query the number of non-null values in the water_level field from the h2o_feet measurement:

> SELECT COUNT("water_level") FROM h2o_feet
name: h2o_feet
--------------
time                     count
1970-01-01T00:00:00Z     15258

Query the first five observed values from the h2o_feet measurement:

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

Note and data sources

The sample data is released by the National Oceanic and Atmospheric Administration's (NOAA) Center for Operational Oceanographic Products and Services. The sample data includes 15,258 observed values for water levels and the values were collected every six seconds in Santa Monica and Coyote Creek of California from August 18, 2015 to September 18, 2015. The measurement unit for water levels is feet. The ID of Santa Monica is 9410840 and the ID of Coyote Creek is 9414575.

Take note that the average_temperature, h2o_pH, h2o_quality, and h2o_temperature measurements contain fictional data. The fictional data is used to illustrate the query feature that is described in the Schema exploration topic.

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