Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

SiRQL is a simple language specification which defines the way how to receive and query data over an http request.

Project Description

SiRQL (pronounced **ˈsɜːrkl**) is a simple language specification which defines the way how to receive and query data over an http request.

The goal of SiRQL is to provide a simple and human readable query text and the possibility to define query fields in swagger.

Implementations

Python

pip install SiRQL

Definition 1.3

Example

This is a simple example of a SiRQL query which receives all the users which are called Florian and are happy.

http://example/users/find?name=eq("Florian")&is_happy=is(TRUE)

Conditions

SiRQL uses the uniform resource identifier (URI) specification to define queries and send them over http to the server.

Usually the REST protocol is used to serve the result and query the data.

baseurl/find?``condition1``&condition2&condition3

The conditions are combined with the AND operator:

condition1 AND condition2 AND condition3

Structure

A condition is always structured by following pattern:

field_name = operator(param1, param2, …)

name description
resource_name The resource field name which
operator Read about operators in the next chapter
param1, param2, … A parameter contains one value which will be used to query the data

Operators

Currently SiRQL supports following operators with these limitations:

  • Per query field only one operator can be used
  • Operators are not case sensitive

Less than (lt)

Compares the field value to the parameter and returns True if the field value is lower then the parameter.

http://example/data/find?age=lt(10)

Greater than (gt)

Compares the field value to the parameter and returns True if the field value is higher then the parameter.

http://example/data/find?age=gt(10)

Between (between)

Compares the field value to the parameters and returns True if the field value is higher than the first parameter and lower than the second parameter.

http://example/data/find?age=between(5, 10)

Equals to (eq)

Compares the field value to the parameters and returns True if the field value matches one of the parameters exactly.

Usually only one parameter is used:

http://example/data/find?name=eq("Florian")

It is possible to add multiple parameters which could match:

http://example/data/find?name=eq("Florian", "Manuel")

Results in a query like:

if name is "Florian" OR "Manuel"

Like (like)

Compares the field value to the parameter and returns True if the field value matches the parameter.

Wildcards like % can be used in the parameter string:

http://example/data/find?name=like("Flo%")

Is (is)

Returns True if the field value matches the given type.

http://example/data/find?name=is(NULL)
http://example/data/find?name=is(FALSE)
http://example/data/find?name=is(TRUE)

Negation (not)

To negate an operator it is possible to use not_ as operator prefix. With the not_ prefix the result of the expression will be negated.

This will match all values which are not Florian:

http://example/data/find?name=not_eq("Florian")

Other examples:

http://example/data/find?is_happy=not_is(True)
http://example/data/find?age=not_gt(10)
http://example/data/find?age=not_between(5, 10)

Exists (exists)

Returns True if the field exists in the result.

http://example/data/find?time=exists()

String Parameter

To pass text as a parameter it is possible to use quotes ". In a string query reserved characters like =, (, ), , are automatically escaped. Usually this is used to compare text or query date-time.

http://example/data/find?comment=eq("hello, (world)")

String Escaping

 Quotes

To escape quotes in strings it is possible to use the backslash character \ in front of the quote sign ". With that it is possible to use quote signs in strings.

http://example/data/find?comment=eq("hello \"world\"")
Backslash

To escape a backslash \ it is possible to write a double–backlash which will be interpreted as one backslash.

http://example/data/find?comment=eq("hello \\ world")

About

Defined by i4Ds 2015

Release History

Release History

This version
History Node

1.3.2

History Node

1.3.1

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
SiRQL-1.3.2.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Oct 26, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting