Skip to content

Commit

Permalink
nikdebug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara3l committed Oct 11, 2023
1 parent f77734b commit 22fb9d4
Show file tree
Hide file tree
Showing 2,805 changed files with 55,012 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ docs/node_modules
docs/public
docs/resources/_gen
docs/tmp/
docs/versioned_docs
#docs/versioned_docs
docs/.hugo_build.lock
111 changes: 111 additions & 0 deletions docs/versioned_docs/1.2/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
title: "Introduction"
linkTitle: "Introduction"
weight: 10
sectionIndex: false
cascade:
- type: "docs"
toc_root: true
_target:
path: "/*/**"
---

GoodData Python SDK provides a clean and convenient way to interact with the [GoodData API](https://www.gooddata.com/developers/cloud-native/doc/cloud/api-and-sdk/api/) in Python applications.

Python is a popular language for working with large amounts of data and data analytics; It is for this reason that we are actively developing this SDK to let Python developers integrate the GoodData analytical engine into their own applications as seamlessly as possible, or to automate their administrative workflow.

![Relationship to GoodData](./figures/Python_doc_flat.png)



## What is Python SDK Good For



Python SDK lets you script things that may otherwise be very tedious to do using the GoodData user interface alone, such as:

#### Automate the provisioning

You can perform administration tasks such as managing users, permissions and create new workspaces, their hierarchies and data sources. With Python SDK you can write scripts that will let you easily create new users and workspaces, as well as manage existing ones.

```python
sdk.catalog_data_source.create_or_update_data_source(
CatalogDataSourcePostgres(
id=data_source_id,
name=data_source_name,
db_specific_attributes=PostgresAttributes(
host=os.environ["POSTGRES_HOST"],
db_name=os.environ["POSTGRES_DBNAME"]
),
schema=os.environ["POSTGRES_SCHEMA"],
credentials=BasicCredentials(
username=os.environ["POSTGRES_USER"],
password=os.environ["POSTGRES_PASSWORD"],
),
)
)
```

#### Integrate into CI/CD pipelines

Integrate GoodData analytics into your continuous delivery practices by, for example, automatically transplanting content from your staging workspaces to your production workspaces at an appropriate time in your production and delivery cycle.

```python
# Reads visualizations from workspace
insights = sdk.insights.get_insights("123")

# Iterate through visualizations and check if they are valid
for insight in insights:
try:
sdk.tables.for_insight("123", insight)
except Exception:
print(f"Visualization {insight.title} is broken.")

```

#### Create data pipelines

Export your data, levarage services like machine learning to transform your data and import the data back into GoodData to visualize the results and gain insights. In the Example below, we demonstrate GoodPandas, which can leverage machine learning practices.
```python
pandas = GoodPandas(os.getenv('HOST'), os.getenv('TOKEN'))
df = pandas.data_frames(workspace_id="123")

campaign_spend = df.for_insight("campaign_spend")

# Now you have a dataframe with data from your visualization
# You can do linear regression, clustering, predictions, analysis, etc.
```


![Relationship to GoodData](./figures/Python_doc_isometric.png)

### What is Python SDK Not Good For

Python SDK is not designed to facilitate the embedding of GoodData analytics into the front-end of your web applications. For customizable embedding of visualizations and dashboard, see our [React SDK](https://sdk.gooddata.com/gooddata-ui/docs/about_gooddataui.html).

## What Can I Do With Python SDK

With Python SDK you have full control over:

* Workspaces
* Workspace hierarchies
* Workspace data filters
* Data sources
* Logical data models
* Workspace content
* Facts
* Attributes
* Labels
* Metrics
* Visualizations

You can also perform certain administration tasks:

* Manage users and user groups
* Manage workspace permissions and hierarchyPermissions

## Where to Learn More

Get started with Python SDK right now by following the [Quick Start](./getting-started/#quick-start) guide.

New to GoodData? Follow the [Getting Started](https://www.gooddata.com/developers/cloud-native/doc/cloud/getting-started/) series of articles that include Python SDK code examples.
7 changes: 7 additions & 0 deletions docs/versioned_docs/1.2/administration/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Administration"
linkTitle: "Administration"
weight: 20
no_list: true
navigationLabel: true
---
37 changes: 37 additions & 0 deletions docs/versioned_docs/1.2/administration/organization/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "Organization"
linkTitle: "Organization"
weight: 10
no_list: true
---

Manage an organization.

See [Manage Organizations](https://www.gooddata.com/developers/cloud-native/doc/cloud/manage-deployment/set-up-organizations/manage-organizations/) to learn how organizations work in GoodData.

## Methods

* [update_name](./update_name/)
* [update_oidc_parameters](./update_oidc_parameters/)

## Example

Update organization's name and OIDC provider:

```python
from gooddata_sdk import GoodDataSdk

# GoodData base URL, e.g. "https://www.example.com"
host = "https://www.example.com"
# GoodData user token
token = "some_user_token"
sdk = GoodDataSdk.create(host, token)

# Update organization name
sdk.catalog_organization.update_name(name="new_organization_name")

# Update OIDC provider
sdk.catalog_organization.update_oidc_parameters(oauth_client_id="oauth_client_id",
oauth_issuer_location="oauth_issuer_location",
oauth_client_secret="oauth_client_secret")
```
30 changes: 30 additions & 0 deletions docs/versioned_docs/1.2/administration/organization/update_name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "update_name"
linkTitle: "update_name"
weight: 10
no_list: true
superheading: "catalog_organization."
---



``update_name(name: str)``

Updates the name of the organization.

{{% parameters-block title="Parameters"%}}

{{< parameter p_name="name" p_type="string" >}}
New name of the organization
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" None="yes"%}}
{{% /parameters-block %}}

## Example

```python
# Update organization name
sdk.catalog_organization.update_name(name="new_organization_name")
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "update_oidc_parameters"
linkTitle: "update_oidc_parameters"
weight: 20
no_list: true
superheading: "catalog_organization."
---



``update_oidc_parameters(oauth_issuer_location: Optional[str] = None, oauth_client_id: Optional[str] = None, oauth_client_secret: Optional[str] = None)``

Updates the OIDC parameters for a given users.

{{% parameters-block title="Parameters"%}}

{{< parameter p_name="oauth_issuer_location" p_type="Optional[string]" >}}
Issuer location. Defaults to None.
{{< /parameter >}}
{{< parameter p_name="oauth_client_id" p_type="Optional[string]" >}}
Public client identifier. Defaults to None.
{{< /parameter >}}
{{< parameter p_name="oauth_client_secret" p_type="Optional[string]" >}}
Client secret. Defaults to None.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" None="yes"%}}
{{% /parameters-block %}}

{{% parameters-block title="Raises"%}}
{{< parameter p_name="ValueError" >}}
Parameters were not strictly all none or all string.
{{< /parameter >}}
{{% /parameters-block %}}

## Example

```python
# Update OIDC provider
sdk.catalog_organization.update_oidc_parameters(oauth_client_id="oauth_client_id",
oauth_issuer_location="oauth_issuer_location",
oauth_client_secret="oauth_client_secret")
```
40 changes: 40 additions & 0 deletions docs/versioned_docs/1.2/administration/permissions/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: "Permissions"
linkTitle: "Permissions"
weight: 20
no_list: true
---

Manage workspace permissions.

See [Manage Permissions](https://www.gooddata.com/developers/cloud-native/doc/cloud/manage-deployment/manage-permissions/) to learn how permissions work in GoodData.

### Declarative Methods

* [get_declarative_permissions](./get_declarative_permissions/)
* [put_declarative_permissions](./put_declarative_permissions/)

## Example

Get, modify and then set permissions for a given workspace:

```python
from gooddata_sdk import GoodDataSdk

# GoodData base URL, e.g. "https://www.example.com"
host = "https://www.example.com"
# GoodData user token
token = "some_user_token"
sdk = GoodDataSdk.create(host, token)

workspace_id = "123"

# Get permissions in declarative from
declarative_permissions = sdk.catalog_permission.get_declarative_permissions(workspace_id=workspace_id)

declarative_permissions.permissions = []

# Update permissions on the server with your changes
sdk.catalog_permission.put_declarative_permissions(workspace_id=workspace_id,
declarative_workspace_permissions=declarative_permissions)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "get_declarative_permissions"
linkTitle: "get_declarative_permissions"
weight: 10
no_list: true
superheading: "catalog_permission."
---



``get_declarative_permissions(workspace_id: str)``

Gets the current set of permissions of the workspace in a declarative form.

{{% parameters-block title="Parameters"%}}
{{< parameter p_name="workspace_id" p_type="string" >}}
Workspace identification string. e.g. "demo"
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_type="CatalogDeclarativeWorkspacePermissions" >}}
Object Containing Workspace Permissions.
{{< /parameter >}}
{{% /parameters-block %}}

## Example

```python
# Get permissions in declarative from
declarative_permissions = sdk.catalog_permission.get_declarative_permissions(workspace_id=workspace_id)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "put_declarative_permissions"
linkTitle: "put_declarative_permissions"
weight: 20
no_list: true
superheading: "catalog_permission."
---



``put_declarative_permissions(workspace_id: str, declarative_workspace_permissions: CatalogDeclarativeWorkspacePermissions)``

Sets the permissions for the workspace.

{{% parameters-block title="Parameters"%}}
{{< parameter p_name="workspace_id" p_type="string" >}}
Workspace identification string. e.g. "demo"
{{< /parameter >}}
{{< parameter p_name="declarative_workspace_permissions" p_type="CatalogDeclarativeWorkspacePermissions" >}}
Object Containing Workspace Permissions.
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns" None="yes" %}}
{{% /parameters-block %}}

## Example

```python
# Update permissions on the server with your changes
sdk.catalog_permission.put_declarative_permissions(workspace_id=workspace_id,
declarative_workspace_permissions=declarative_permissions)
```
Loading

0 comments on commit 22fb9d4

Please sign in to comment.