Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
namara / docs / QueryService.md
Size: Mime:

Query Service

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.

Prerequisites

Before trying to call any service method on the Namara client, make sure you follow the authorization steps in the README.

Querying Data

Suppose we have the following data set imported in Namara.

Row Data

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"

Column Metadata

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"