Skip to content

Commit 83a84fd

Browse files
Openblocks-docsgitbook-bot
Openblocks-docs
authored andcommitted
GitBook: [lowcoder-org#68] add docs: "Query library"
1 parent 74c6592 commit 83a84fd

18 files changed

+92
-3
lines changed
91.2 KB
Loading
64.5 KB
Loading
97.8 KB
Loading
78.2 KB
Loading
87.4 KB
Loading
94 KB
Loading
82.2 KB
Loading
84.1 KB
Loading
34.6 KB
Loading
106 KB
Loading
126 KB
Loading
117 KB
Loading
22.8 KB
Loading
77.6 KB
Loading

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## Queries
1616

1717
* [Query basics](queries/query-basics.md)
18+
* [Query library](queries/query-library.md)
1819

1920
## Build apps
2021

docs/data-sources/configure-ip-allowlists.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If your data source has firewall rules, it is vital to add IP addresses of Openblocks to the allowlist before connection. Then you can connect to databases or APIs and create queries.
44

5-
### Allow IP addresses of Openblocks
5+
## Allow IP addresses of Openblocks
66

77
Add the following IP addresses to your data source allowlist when needed:
88

docs/queries/query-library.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Query library
2+
3+
**Query Library** lets you store, reuse and share queries across your workspace. Create and run queries in query library, and call them from any Openblocks app.
4+
5+
## Features
6+
7+
The main function of the query **** library is to create and manage reusable queries:
8+
9+
* Writing queries based on data sources, with the ability to define **Inputs** variables.\
10+
11+
12+
<figure><img src="../.gitbook/assets/query library 1.png" alt=""><figcaption></figcaption></figure>
13+
* Importing and triggering queries from query library in apps and modules.\
14+
15+
16+
<figure><img src="../.gitbook/assets/query library 2.png" alt=""><figcaption></figcaption></figure>
17+
* Referencing different versions of queries.\
18+
19+
20+
<figure><img src="../.gitbook/assets/query library 3.png" alt=""><figcaption></figcaption></figure>
21+
22+
## Create a new query
23+
24+
1. Click **+ New** and select a data source.
25+
26+
<figure><img src="../.gitbook/assets/query library 4.png" alt=""><figcaption></figcaption></figure>
27+
28+
29+
30+
<figure><img src="../.gitbook/assets/query library 5.png" alt=""><figcaption></figcaption></figure>
31+
2. Rename the query on demand.
32+
3. Write code and click ▶ **Run** to get results. The results will display in the bottom pane of the window.
33+
34+
<figure><img src="../.gitbook/assets/query library 6.png" alt=""><figcaption></figcaption></figure>
35+
36+
### Input parameters
37+
38+
There are cases where you want to pass dynamic parameters to a query. Openblocks supports that by introducing input configuration of a query.
39+
40+
Click **Add** in the **Inputs** tab in the right pane to add input parameters. Reference them using `{{}}` in the query, then you can input test values to test execution of the query.
41+
42+
<figure><img src="../.gitbook/assets/query library 7.png" alt=""><figcaption></figcaption></figure>
43+
44+
{% hint style="warning" %}
45+
You can only reference variables instead of writing JavaScript code in `{{}}`.
46+
{% endhint %}
47+
48+
To edit the name and description of the input variables, click `...` and select **Edit** or directly click the title of the variable.
49+
50+
<figure><img src="../.gitbook/assets/query library 8.png" alt=""><figcaption></figcaption></figure>
51+
52+
## Version management
53+
54+
Queries may be updated on demand. You can make an adjustment to a query to a newer version and at the same time maintain the older version. Such version management is achievable in query library. Click `···` in the top right corner to publish different versions of queries, and you can view and restore history versions.
55+
56+
<figure><img src="../.gitbook/assets/query library 9.png" alt=""><figcaption></figcaption></figure>
57+
58+
### Publish
59+
60+
When you finish writing a version of the query, you can publish it. Click `···` > **Publish**. Use [semantic versioning](https://semver.org/) (also known as SemVer) to name your version.
61+
62+
<figure><img src="../.gitbook/assets/query library 10.png" alt=""><figcaption></figcaption></figure>
63+
64+
### History version
65+
66+
To view and restore the history versions, go to `···` > **History version**.
67+
68+
You can restore your current draft to a history version by selecting the target version from the history version list and clicking **Restore this version**. Click **Exit** to return to edit mode.
69+
70+
<figure><img src="../.gitbook/assets/query library 11.png" alt=""><figcaption></figcaption></figure>
71+
72+
## Import a query
73+
74+
1. In an app or module, Click **+ New** in the **Query editor** in the bottom pane, then select **Import from Query Library**.
75+
76+
<figure><img src="../.gitbook/assets/query library 12.png" alt=""><figcaption></figcaption></figure>
77+
2. Select a query from the library from the dropdown list, choose your desired version and pass in corresponding input parameters.
78+
79+
<figure><img src="../.gitbook/assets/query library 13.png" alt=""><figcaption></figcaption></figure>
80+
81+
82+
83+
<figure><img src="../.gitbook/assets/query library 14.png" alt=""><figcaption></figcaption></figure>
84+
3. For other settings, see [query-basics.md](query-basics.md "mention").
85+
86+
## Permissions
87+
88+
Workspace **Admin** and members of **Developers** group have access to the **Query Library** and have read and write permissions to all queries in the library.

docs/workspace-management/permissions-for-resources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
description: >-
3-
Manage permissions for apps, modules, queries, data sources and folders in
3+
Manage permissions for apps, modules, queries, data sources, and folders in
44
your workspace.
55
---
66

77
# Permissions for resources
88

9-
Openblocks implements [Role-based Access Control](https://en.wikipedia.org/wiki/Role-based\_access\_control) (RBAC) by assigning a set of permissions to different roles. These permissions determine the actions users can take on resources, including apps, modules, queries, data sources and folders.&#x20;
9+
Openblocks implements [Role-based Access Control](https://en.wikipedia.org/wiki/Role-based\_access\_control) (RBAC) by assigning a set of permissions to different roles. These permissions determine the actions users can take on resources, including apps, modules, queries, data sources, and folders.&#x20;
1010

1111
Only workspace admins and members of Developers group are allowed to create resources. For workspace admins, they are in fact the owner of all resources.
1212

0 commit comments

Comments
 (0)