Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .aida/rules/packages/gooddata-sdk.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ alwaysApply: false
- Compute services (execution, caching, export)
- Visualization services (insights, dashboards)
- Declarative API support (layout export/import)
- Analytics-as-Code (AAC) YAML support via `gooddata-code-convertors`
- `gdc` CLI for deploying/cloning AAC and declarative layouts
- Model management (LDM, PDM operations)

## Does NOT Own
Expand All @@ -31,7 +33,11 @@ alwaysApply: false

**Service-based**: `catalog_*`, `compute_*`, `insights_*`, `tables_*`

**Depends on**: `gooddata-api-client` (generated OpenAPI client)
**Depends on**: `gooddata-api-client` (generated OpenAPI client), `gooddata-code-convertors` (AAC↔declarative conversion via WASM)

**AAC module**: `catalog/workspace/aac.py` — conversion functions and workspace-level load/store

**CLI**: `cli/` — `gdc` command for deploy/clone with AAC YAML support, reads `gooddata.yaml`

## SDK Usage

Expand Down
16 changes: 0 additions & 16 deletions .claude/CLAUDE.md

This file was deleted.

15 changes: 15 additions & 0 deletions docs/content/en/latest/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ Start integrating GoodData into your Python application right now.

The `token` field should reference an environment variable that holds your personal access token. The `access` field can include references to environment variables with data source secrets, or it can be left empty if not needed.

If you use the GoodData VSCode extension, the SDK can read its `gooddata.yaml` config file directly:

```yaml
profiles:
default:
host: "https://www.example.com"
token: "$GOODDATA_API_TOKEN"
workspace_id: "my-workspace" # used by gdc CLI
data_source: "my-datasource" # used by gdc CLI
default_profile: "default"
source_dir: "analytics" # used by gdc CLI
```

The `workspace_id`, `data_source`, and `source_dir` fields are used by the `gdc` CLI for [Analytics-as-Code workflows](../workspace/workspaces/#analytics-as-code-aac-methods) and are ignored by the SDK API client.

1. Start using Python SDK! For example, get a list of all workspaces:

```python
Expand Down
5 changes: 5 additions & 0 deletions docs/content/en/latest/workspace/workspaces/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ Manage workspaces. Entity and Declarative methods are supported.
* [get_declarative_automations](./get_declarative_automations/)
* [put_declarative_automations](./put_declarative_automations/)

### Analytics-as-Code (AAC) Methods

* [load_and_put_aac_workspace](./load_and_put_aac_workspace/)
* [get_and_store_aac_workspace](./get_and_store_aac_workspace/)


## Example

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: "get_and_store_aac_workspace"
linkTitle: "get_and_store_aac_workspace"
weight: 136
superheading: "catalog_workspace."
api_ref: "CatalogWorkspaceService.get_and_store_aac_workspace"
---

<!-- AUTO-GENERATED FROM DOCSTRING — do not edit above this line -->

<div class="python-ref">
<p><code>get_and_store_aac_workspace(workspace_id: str, source_dir: Path)</code></p>
<div class="python-ref-description">
<p>Get declarative workspace from server, convert to AAC YAML files, and write to disk.</p>
</div>
<h4>Parameters</h4>
<table class="gd-docs-parameters-block">
<thead>
<tr>
<th>name</th>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<th padding="0px">workspace_id
<th padding="0px">str
<th>
Workspace identification string e.g. "demo"
</tr>
<tr>
<th padding="0px">source_dir
<th padding="0px">Path
<th>
Path to the directory where AAC YAML files will be written.
</tr>
</tbody>
</table>
<h4>Returns</h4>
<i>None</i>
</div>

## Example

Clone a workspace layout as AAC YAML files:

```python
from pathlib import Path
from gooddata_sdk import GoodDataSdk

host = "https://www.example.com"
token = "some_user_token"
sdk = GoodDataSdk.create(host, token)

# Clone workspace to AAC YAML files
sdk.catalog_workspace.get_and_store_aac_workspace(
workspace_id="demo",
source_dir=Path("analytics")
)
```

This creates typed subdirectories under the target path:

```
analytics/
datasets/
campaigns.yaml
orders.yaml
metrics/
revenue.yaml
visualisations/
revenue_chart.yaml
dashboards/
overview.yaml
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: "load_and_put_aac_workspace"
linkTitle: "load_and_put_aac_workspace"
weight: 135
superheading: "catalog_workspace."
api_ref: "CatalogWorkspaceService.load_and_put_aac_workspace"
---

<!-- AUTO-GENERATED FROM DOCSTRING — do not edit above this line -->

<div class="python-ref">
<p><code>load_and_put_aac_workspace(workspace_id: str, source_dir: Path)</code></p>
<div class="python-ref-description">
<p>Load AAC YAML files from source_dir, convert to declarative, and deploy to workspace.</p>
</div>
<h4>Parameters</h4>
<table class="gd-docs-parameters-block">
<thead>
<tr>
<th>name</th>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<th padding="0px">workspace_id
<th padding="0px">str
<th>
Workspace identification string e.g. "demo"
</tr>
<tr>
<th padding="0px">source_dir
<th padding="0px">Path
<th>
Path to the directory containing AAC YAML files.
</tr>
</tbody>
</table>
<h4>Returns</h4>
<i>None</i>
</div>

## Example

Deploy AAC YAML files from a local directory to a workspace:

```python
from pathlib import Path
from gooddata_sdk import GoodDataSdk

host = "https://www.example.com"
token = "some_user_token"
sdk = GoodDataSdk.create(host, token)

# Deploy AAC YAML files to workspace
sdk.catalog_workspace.load_and_put_aac_workspace(
workspace_id="demo",
source_dir=Path("analytics")
)
```

The AAC YAML directory can contain typed subdirectories:

```
analytics/
datasets/
campaigns.yaml
orders.yaml
metrics/
revenue.yaml
visualisations/
revenue_chart.yaml
dashboards/
overview.yaml
```

Each YAML file has a `type` field that determines its kind:

```yaml
type: metric
id: revenue
title: Revenue
maql: SELECT SUM({fact/amount})
format: "#,##0"
```
Loading