Skip to content

Commit 0ea44f2

Browse files
authored
Merge pull request #1170 from janmatzek/jmat-SVS-1254-docs-user-data-filter-provisioning
docs(gooddata-pipelines): add user data filters documentation
2 parents bd35244 + fecf874 commit 0ea44f2

File tree

2 files changed

+140
-1
lines changed

2 files changed

+140
-1
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
title: "User Data Filters"
3+
linkTitle: "User Data Filters"
4+
weight: 4
5+
---
6+
7+
User Data Filter (UDF) provisioning lets you manage UDFs in your GoodData environment.
8+
9+
UDFs are currently managed only in full load mode, meaning your input overwrites existing UDFs for each workspace present in the input.
10+
11+
This tool currently supports only the `{column} IN (udf_value)` MAQL pattern. UDFs using more complex MAQL expressions must be set up manually.
12+
13+
{{% alert color="info" %}} Visit [Set Up Data Filters for Users](https://www.gooddata.com/docs/cloud/workspaces/user-data-filters/) to learn more about User Data Filters setup and use cases in GoodData. {{% /alert %}}
14+
15+
## Usage
16+
17+
Start by importing and initializing the `UserDataFilterProvisioner`.
18+
19+
```python
20+
from gooddata_pipelines import UserDataFilterProvisioner
21+
22+
host = "http://localhost:3000"
23+
token = "some_user_token"
24+
25+
# Initialize the provisioner with GoodData credentials
26+
provisioner = UserDataFilterProvisioner.create(host=host, token=token)
27+
28+
```
29+
30+
Then, set the LDM and MAQL column names used by the UDF:
31+
32+
```python
33+
provisioner.set_ldm_column_name("ldm_column_name")
34+
provisioner.set_maql_column_name("{attribute/dataset.field_name}")
35+
36+
```
37+
38+
39+
Next, validate the input data using the `UserDataFilterFullLoad` model.
40+
41+
The model expects the following fields:
42+
43+
| name | description |
44+
|---------------|---------------------------------------------------------------------------------------------|
45+
| workspace_id | ID of the workspace where the UDF will be applied. |
46+
| udf_id | ID of the UDF to be created. Should be equal to the ID of the user the UDF will be applied to. |
47+
| udf_value | Value for the UDF. |
48+
49+
{{% alert color="info" title="Note on IDs"%}}
50+
Each ID can only contain allowed characters. See [Workspace Object Identification](https://www.gooddata.com/docs/cloud/create-workspaces/objects-identification/) to learn more about object identifiers.
51+
{{% /alert %}}
52+
53+
Add the model to your imports and create validated instances:
54+
55+
```python
56+
# Add the model to the imports
57+
from gooddata_pipelines import UserDataFilterFullLoad, UserDataFilterProvisioner
58+
59+
host = "http://localhost:3000"
60+
token = "some_user_token"
61+
62+
# Initialize the provisioner with GoodData credentials
63+
provisioner = UserDataFilterProvisioner.create(host=host, token=token)
64+
65+
# Validate your data
66+
validated_data = [
67+
UserDataFilterFullLoad(
68+
workspace_id="workspace_id_1",
69+
udf_id="user_id_1",
70+
udf_value="udf_value_1",
71+
)
72+
]
73+
74+
```
75+
76+
Now, with the provisioner initialized and your data validated, run the provisioner:
77+
78+
```python
79+
# Import, initialize, validate...
80+
...
81+
82+
# Run the provisioning method
83+
provisioner.full_load(validated_data)
84+
85+
```
86+
87+
## Examples
88+
89+
Here is a complete example of a full load UDF provisioning workflow:
90+
91+
```python
92+
import logging
93+
94+
from gooddata_pipelines import UserDataFilterFullLoad, UserDataFilterProvisioner
95+
96+
host = "http://localhost:3000"
97+
token = "some_user_token"
98+
99+
# Initialize the provisioner
100+
provisioner = UserDataFilterProvisioner.create(host=host, token=token)
101+
102+
# Set the column names to be used in the UDF
103+
provisioner.set_ldm_column_name("ldm_column_name")
104+
provisioner.set_maql_column_name("{attribute/dataset.field_name}")
105+
106+
# Optional: set up logging and subscribe to logs emitted by the provisioner
107+
logging.basicConfig(level=logging.INFO)
108+
logger = logging.getLogger(__name__)
109+
110+
provisioner.logger.subscribe(logger)
111+
112+
# Prepare your data
113+
raw_data = [
114+
{
115+
"workspace_id": "workspace_id_1",
116+
"udf_id": "user_id_1",
117+
"udf_value": "udf_value_1"
118+
},
119+
{
120+
"workspace_id": "workspace_id_1",
121+
"udf_id": "user_id_2",
122+
"udf_value": "udf_value_2"
123+
},
124+
]
125+
126+
# Validate the data
127+
validated_data = [
128+
UserDataFilterFullLoad(
129+
workspace_id=item["workspace_id"],
130+
udf_id=item["udf_id"],
131+
udf_value=item["udf_value"],
132+
)
133+
for item in raw_data
134+
]
135+
136+
# Run the provisioning with the validated data
137+
provisioner.full_load(validated_data)
138+
139+
```

docs/content/en/latest/pipelines/provisioning/workspace-permissions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Workspace Permissions"
33
linkTitle: "Workspace Permissions"
4-
weight: 4
4+
weight: 5
55
---
66

77
Workspace permission provisioning allows you to create, update, or delete user permissions. See [Manage Workspace Permissions](https://www.gooddata.com/docs/cloud/manage-organization/manage-permissions/set-permissions-for-workspace/) to learn more about workspace permissions in GoodData Cloud.

0 commit comments

Comments
 (0)