|
| 1 | +--- |
| 2 | +title: "Pipelines Overview" |
| 3 | +linkTitle: "Pipelines Overview" |
| 4 | +weight: 14 |
| 5 | +--- |
| 6 | + |
| 7 | +GoodData Pipelines contains tools for automation of GoodData life cycle. Built over GoodData Python SDK, it allows you to conveniently manage user profiles, workspace permissions and more. |
| 8 | + |
| 9 | +For further information, refer to the PIPELINES section in the left navigation menu. |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | + |
| 14 | +Run the following command to install the ``gooddata-pipelines`` package on your system: |
| 15 | + |
| 16 | +```bash |
| 17 | +pip install gooddata-pipelines |
| 18 | +``` |
| 19 | + |
| 20 | +### Requirements |
| 21 | + |
| 22 | +- Python 3.10 or newer |
| 23 | +- GoodData.CN or GoodData Cloud |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +## Examples |
| 28 | +Here are a couple of introductory examples how to manage GoodData resources using Pipelines: |
| 29 | + |
| 30 | +### Provision Child Workspaces |
| 31 | +```python |
| 32 | +from gooddata_pipelines import WorkspaceProvisioner, WorkspaceFullLoad |
| 33 | + |
| 34 | +# GoodData.CN host in the form of uri eg. "http://localhost:3000" |
| 35 | +host = "http://localhost:3000" |
| 36 | + |
| 37 | +# GoodData.CN user token |
| 38 | +token = "some_user_token" |
| 39 | + |
| 40 | +# Initialize the provisioner |
| 41 | +provisioner = WorkspaceProvisioner.create(host=host, token=token) |
| 42 | + |
| 43 | +# Gather the definitions of the workspaces you want to create |
| 44 | +raw_data: list[dict] = [ |
| 45 | + { |
| 46 | + "parent_id": "parent_workspace_id", |
| 47 | + "workspace_id": "child_workspace_0", |
| 48 | + "workspace_name": "Child Workspace 0", |
| 49 | + "workspace_data_filter_id": "data_filter_id", |
| 50 | + "workspace_data_filter_values": ["value_0"], |
| 51 | + }, |
| 52 | + ... |
| 53 | + ] |
| 54 | + |
| 55 | +# Validate the data |
| 56 | +validated_data = [WorkspaceFullLoad(**item) for item in raw_data] |
| 57 | + |
| 58 | +# Run the provisioning |
| 59 | +provisioner.full_load(validated_data) |
| 60 | +``` |
| 61 | + |
| 62 | +### Workspace Backup |
| 63 | +```python |
| 64 | +from gooddata_pipelines import BackupManager, BackupRestoreConfig |
| 65 | + |
| 66 | +# GoodData.CN host in the form of uri eg. "http://localhost:3000" |
| 67 | +host = "http://localhost:3000" |
| 68 | + |
| 69 | +# GoodData.CN user token |
| 70 | +token = "some_user_token" |
| 71 | + |
| 72 | +# Define a list with IDs of workspaces you want to back up |
| 73 | +workspaces_to_back_up = ["workspace_id_1", "workspace_id_2"] |
| 74 | + |
| 75 | +# Configure backup options |
| 76 | +config = BackupRestoreConfig(storage_type="local") |
| 77 | + |
| 78 | +# Initialize the backup manager |
| 79 | +backup_manager = BackupManager.create(config, host, token) |
| 80 | + |
| 81 | +# Run the backup |
| 82 | +backup_manager.backup_workspaces(workspace_ids=workspaces_to_back_up) |
| 83 | + |
| 84 | +``` |
0 commit comments