What is YAQL?
- YAQL means Yet Another Query Language, which is used to process and filter the data in data source like JSON, YAML etc.
- YAQL can be embedded and also extensible query language.
- YAQL query is similar like SQL query to search and operate on data.
- YAQL query processor can be easily integrated in your code.
- Queries are based on DSL's(Domain Specific Language), JSON, YAML and user inputs etc.
- It's used to perform the complex queries against arbitrary objects.
- Rich predefined functions and user defined functions are also possible in YAQL to extend.
- YAQL has been developed in python.
- YAQL is distributed through PyPi (Python Package index).
- CLI tool and python module are two different ways to use the YAQL.
How to install YAQL?
There are two different ways
pip install yaql
//Using system package manager:
yum install python-yaql
how to get into YAQL environment?
Once installed YAQL on the machine, 'yaql' shell command can be used to get into the YAQL environment.
Once run yaql command, you will get YAQL environment as below,
In yaql environment, null is returned if you run $ simply without loading any data in the environment.
If you have input data as json format, use @load command is available in YAQL to load data in the environment.
Data from file input.json loaded into context
How can we access input data in YAQL?
Once input data is loaded in the environment, $ can be used to access the input data.
To access name field in the input data,