AgriQL · Documentation · Queries
What you can ask
These statements are part of AgriQL 3.10.1. A summary reads one table. Names below are examples. Your table and column names are the ones you imported.
Name the database
USE DATABASE farm; CREATE SCHEMA agriculture; SHOW SCHEMAS;
Each agriql query starts fresh, so USE DATABASE belongs in the same request as the statement that follows it.
Bring a file in
IMPORT CSV 'soil.csv' INTO agriculture.soil;
The same form accepts TSV, JSON, and XLSX. The import records the source file. A Parquet file, or a spreadsheet that exists only at a web address, is refused.
Summarise one table
SELECT plant_id, AVG(soil_moisture) FROM agriculture.soil WHERE soil_moisture < 25 GROUP BY plant_id;
COUNT, MIN, MAX, and STDDEV are the other aggregates. There is no join of two tables in this release.
Look at the quality
PROFILE agriculture.soil; SERIES agriculture.soil ON observed_at;
PROFILE reports empty values and unusual numbers. SERIES … ON counts gaps along the column you name.
Write it back out
EXPORT XLSX agriculture.soil TO 'soil.xlsx';
CSV, TSV, and JSON can be written the same way.
From the command, name the database in the same request, because each request starts fresh:
agriql query "USE DATABASE farm; PROFILE agriculture.soil;"