You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users must be assigned to workload groups to enable resource limiting. When users execute queries, the system applies the workload group's restrictions automatically.
43
43
44
44
```sql
45
-
-- Create and assign user
45
+
-- Create user and grant permissions
46
46
CREATEUSERanalytics_user IDENTIFIED BY 'password123';
47
+
GRANT ALL ON*.* TO analytics_user;
48
+
49
+
-- Assign user to workload group
47
50
ALTERUSER analytics_user WITH SET WORKLOAD GROUP ='interactive_queries';
Copy file name to clipboardExpand all lines: docs/en/sql-reference/20-sql-functions/10-semi-structured-functions/0-json/index.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,9 @@ This section provides reference information for JSON functions in Databend. JSON
37
37
38
38
| Function | Description | Example |
39
39
|----------|-------------|---------|
40
+
|[GET](get)| Extracts value from JSON by index or field name |`GET('{"name":"John"}', 'name')` → `"John"`|
41
+
|[GET_IGNORE_CASE](get-ignore-case)| Extracts value with case-insensitive field matching |`GET_IGNORE_CASE('{"Name":"John"}', 'name')` → `"John"`|
42
+
|[GET_PATH](get-path)| Extracts value using path notation |`GET_PATH('{"user":{"name":"John"}}', 'user.name')` → `"John"`|
40
43
|[JSON_EXTRACT_PATH_TEXT](json-extract-path-text)| Extracts text value from JSON using path |`JSON_EXTRACT_PATH_TEXT('{"name":"John"}', 'name')` → `'John'`|
41
44
|[JSON_EACH](json-each)| Expands JSON object into key-value pairs |`JSON_EACH('{"a":1,"b":2}')` → `[("a",1),("b",2)]`|
42
45
|[JSON_ARRAY_ELEMENTS](json-array-elements)| Expands JSON array into individual elements |`JSON_ARRAY_ELEMENTS('[1,2,3]')` → `1, 2, 3`|
Copy file name to clipboardExpand all lines: docs/en/sql-reference/20-sql-functions/10-semi-structured-functions/index.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,26 +6,44 @@ Structured and semi-structured functions in Databend enable efficient processing
6
6
7
7
## JSON Functions
8
8
9
+
### Parsing & Validation
9
10
| Function | Description | Example |
10
11
|----------|-------------|--------|
11
12
|[PARSE_JSON](json/parse-json)| Parses a JSON string into a variant value |`PARSE_JSON('[1,2,3]')`|
12
13
|[CHECK_JSON](json/check-json)| Validates if a string is valid JSON |`CHECK_JSON('{"a":1}')`|
13
14
|[JSON_TYPEOF](json/json-typeof)| Returns the type of a JSON value |`JSON_TYPEOF(PARSE_JSON('[1,2,3]'))`|
14
-
|[JSON_TO_STRING](json/json-to-string)| Converts a JSON value to a string |`JSON_TO_STRING(PARSE_JSON('{"a":1}'))`|
15
+
16
+
### Path-based Querying
17
+
| Function | Description | Example |
18
+
|----------|-------------|--------|
15
19
|[JSON_PATH_EXISTS](json/json-path-exists)| Checks if a JSON path exists |`JSON_PATH_EXISTS(json_obj, '$.name')`|
16
-
|[JSON_PATH_MATCH](json/json-path-match)| Matches JSON values against a path pattern |`JSON_PATH_MATCH(json_obj, '$.age')`|
17
20
|[JSON_PATH_QUERY](json/json-path-query)| Queries JSON data using JSONPath |`JSON_PATH_QUERY(json_obj, '$.items[*]')`|
18
21
|[JSON_PATH_QUERY_ARRAY](json/json-path-query-array)| Queries JSON data and returns results as an array |`JSON_PATH_QUERY_ARRAY(json_obj, '$.items')`|
19
22
|[JSON_PATH_QUERY_FIRST](json/json-path-query-first)| Returns the first result from a JSON path query |`JSON_PATH_QUERY_FIRST(json_obj, '$.items[*]')`|
20
-
|[JSON_EXTRACT_PATH_TEXT](json/json-extract-path-text)| Extracts text value from JSON using path |`JSON_EXTRACT_PATH_TEXT(json_obj, 'name')`|
23
+
|[JSON_PATH_MATCH](json/json-path-match)| Matches JSON values against a path pattern |`JSON_PATH_MATCH(json_obj, '$.age')`|
24
+
|[JQ](json/jq)| Advanced JSON processing using jq syntax |`JQ('.name', json_obj)`|
25
+
26
+
### Value Extraction
27
+
| Function | Description | Example |
28
+
|----------|-------------|--------|
21
29
|[GET](json/get)| Gets a value from a JSON object by key or array by index |`GET(PARSE_JSON('[1,2,3]'), 0)`|
22
30
|[GET_PATH](json/get-path)| Gets a value from a JSON object using a path expression |`GET_PATH(json_obj, 'user.name')`|
23
31
|[GET_IGNORE_CASE](json/get-ignore-case)| Gets a value with case-insensitive key matching |`GET_IGNORE_CASE(json_obj, 'NAME')`|
24
-
|[JSON_EACH](json/json-each)| Expands JSON object into key-value pairs |`JSON_EACH(PARSE_JSON('{"a":1,"b":2}'))`|
25
-
|[JSON_ARRAY_ELEMENTS](json/json-array-elements)| Expands JSON array into individual elements |`JSON_ARRAY_ELEMENTS(PARSE_JSON('[1,2,3]'))`|
32
+
|[JSON_EXTRACT_PATH_TEXT](json/json-extract-path-text)| Extracts text value from JSON using path |`JSON_EXTRACT_PATH_TEXT(json_obj, 'name')`|
33
+
34
+
### Transformation & Output
35
+
| Function | Description | Example |
36
+
|----------|-------------|--------|
37
+
|[JSON_TO_STRING](json/json-to-string)| Converts a JSON value to a string |`JSON_TO_STRING(PARSE_JSON('{"a":1}'))`|
26
38
|[JSON_PRETTY](json/json-pretty)| Formats JSON with proper indentation |`JSON_PRETTY(PARSE_JSON('{"a":1}'))`|
27
39
|[STRIP_NULL_VALUE](json/strip-null-value)| Removes null values from JSON |`STRIP_NULL_VALUE(PARSE_JSON('{"a":1,"b":null}'))`|
28
40
41
+
### Array/Object Expansion
42
+
| Function | Description | Example |
43
+
|----------|-------------|--------|
44
+
|[JSON_EACH](json/json-each)| Expands JSON object into key-value pairs |`JSON_EACH(PARSE_JSON('{"a":1,"b":2}'))`|
45
+
|[JSON_ARRAY_ELEMENTS](json/json-array-elements)| Expands JSON array into individual elements |`JSON_ARRAY_ELEMENTS(PARSE_JSON('[1,2,3]'))`|
0 commit comments