YAQL API Reference
yaql
YAQL - YAML Advanced Query Language
YAQL provides a standard SQL query interface for YAML data. YAQL dynamically loads YAML data into an in-memory SQLite database, allowing users to execute SQL queries against the data. YAQL generated database schemas are derived from YASL schema definitions, ensuring data integrity and consistency.
export_data(export_path, min_mode=False)
Exports the data from the global YAQL engine to YAML files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
export_path
|
str
|
Directory where the YAML files will be written. |
required |
min_mode
|
bool
|
If True, writes all records of a type to a single file separated by '---'. |
False
|
Returns:
| Type | Description |
|---|---|
int
|
Number of files written. |
Source code in src/yaql/engine.py
649 650 651 652 653 654 655 656 657 658 659 660 | |
get_session()
Get a new SQLModel Session bound to the global YAQL engine.
Returns:
| Type | Description |
|---|---|
Session
|
A new Session object for interacting with the database. |
Source code in src/yaql/engine.py
663 664 665 666 667 668 669 670 | |
load_data(data_path)
Load YAML data files into the global YAQL engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_path
|
str
|
Path to a .yaml/.yml file or a directory containing such files. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The number of data records successfully loaded. |
Source code in src/yaql/engine.py
636 637 638 639 640 641 642 643 644 645 646 | |
load_schema(schema_path)
Load YASL schema definitions into the global YAQL engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_path
|
str
|
Path to a .yasl file or a directory containing .yasl files. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if all schemas were loaded successfully, False otherwise. |
Source code in src/yaql/engine.py
623 624 625 626 627 628 629 630 631 632 633 | |