Repository URL to install this package:
|
Version:
1.3.3 ▾
|
The query service provides easy access to view, aggregate, and join data sets in Namara using NiQL (Namara.io Query Language) statments.
NiQL is very similar similar to SQL. The NiQL language documentation is located in the Query Specification.
Before trying to call any service method on the Namara client, make sure you follow the authorization steps in the README.
Suppose we have the following data set imported in Namara.
We can then query the entire data set by calling query.
response = namara.query("SELECT * FROM 915c9823-c772-4dc6-9fb0-1b393749c012")
Row data can be accessed using response.rows and response.rows[index].cells.
response.rows # => [<Row_0>, <Row_1>, <Row_2>] response.rows[0].cells # => [<Cell_0 value: "Ottawa">, <Cell_1 value: "Ontario"> <Cell_2 value: "Canada">] response.rows[0].cells[0].value # => "Ottawa"
The query service also allows you to view column metadata.
Using the same query:
response = namara.query("SELECT * FROM 915c9823-c772-4dc6-9fb0-1b393749c012")
You can then view the metadata for each column using response.column_metadata.
response.column_metadata # => [<ColumnMetadata_0>, <ColumnMetadata_1>, <ColumnMetadata_2>] response.column_metadata[0] #=> <ColumnMetadata key: "city" type: "string", jdbc_type: "string" title: "City", description: ""> response.column_metadata[0].title # => "City" response.column_metadata[0].type # => "string"