AgriQL · Documentation · Clients

Python, R, and Arrow

The clients send a query to AgriQL and return the rows. Install AgriQL itself before you expect a .aqdb file to open. The Python and R packages call the AgriQL library built with the server or the command.

Build the library

From the AgriQL source directory:

cargo build --release -p agriql-ffi
sudo install -m 755 target/release/libagriql_ffi.so /usr/local/lib/
sudo ldconfig

On macOS the file is libagriql_ffi.dylib. On Windows it is agriql_ffi.dll. If it is not in a default library directory, set AGRIQL_FFI to the full path.

Python

pip install git+https://github.com/SbruiceS/agriql-python.git
import agriql

db = agriql.connect("farm.aqdb")
rows = db.query("SHOW SCHEMAS;").to_records()

A running server is opened by address, not by copying the file:

db = agriql.connect("agriql://192.0.2.10:5471/farm")

to_pandas() and to_polars() work only if those libraries are installed. They are optional.

R

install.packages("remotes")
remotes::install_github("SbruiceS/agriql-r")
library(agriql)
db <- aqdb_connect("farm.aqdb")
aqdb_frame(aqdb_query(db, "SHOW SCHEMAS;"))

The R package compiles a small connector against libagriql_ffi. The library must be on the linker path when you install the package. If it is elsewhere:

AGRIQL_LIBDIR=/usr/local/lib R CMD INSTALL .

Arrow

Arrow does not open a database. It turns a text table into an Arrow file.

pip install git+https://github.com/SbruiceS/agriql-arrow.git
agriql-arrow write soil.tsv soil.arrows
agriql-arrow read soil.arrows

What the clients are not

  • They are not a second copy of the database.
  • They do not accept Parquet.
  • They do not read a spreadsheet that exists only online.