Skip to content

Commit 717471f

Browse files
Merge pull request #1409 from gooddata/snapshot-master-2748e146-to-rel/dev
[bot] Merge master/2748e146 into rel/dev
2 parents a54a959 + 2748e14 commit 717471f

File tree

1,433 files changed

+196035
-182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,433 files changed

+196035
-182
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ api-client: download
5858
rm -f schemas/gooddata-api-client.json
5959
cat schemas/gooddata-*.json | jq -S -s 'reduce .[] as $$item ({}; . * $$item) + { tags : ( reduce .[].tags as $$item (null; . + $$item) | unique_by(.name) ) }' | sed '/\u0000/d' > "schemas/gooddata-api-client.json"
6060
$(call generate_client,api)
61+
# OpenAPI Generator drops the \x00 literal from regex patterns like ^[^\x00]*$,
62+
# producing the invalid Python regex ^[^]*$. Restore the null-byte escape.
63+
find gooddata-api-client/gooddata_api_client -name '*.py' -exec \
64+
sed -i.bak 's/\^\[\^\]\*\$$/^[^\\x00]*$$/g' {} + && \
65+
find gooddata-api-client/gooddata_api_client -name '*.py.bak' -delete
6166

6267
.PHONY: download
6368
download:
@@ -66,6 +71,7 @@ download:
6671
$(call download_client,scan)
6772
$(call download_client,"export")
6873
$(call download_client,automation)
74+
$(call download_client,result)
6975

7076
.PHONY: type-check
7177
type-check:

docs/content/en/latest/data/data-source/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ See [Connect Data](https://www.gooddata.com/docs/cloud/connect-data/) to learn h
3737
* [scan_schemata](./scan_schemata/)
3838
* [scan_sql](./scan_sql/)
3939

40+
### CSV Upload Methods
41+
42+
* [staging_upload](./staging_upload/)
43+
* [analyze_csv](./analyze_csv/)
44+
* [import_csv](./import_csv/)
45+
* [delete_csv_files](./delete_csv_files/)
46+
* [upload_csv](./upload_csv/)
47+
4048

4149
## Example
4250

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "analyze_csv"
3+
linkTitle: "analyze_csv"
4+
weight: 191
5+
superheading: "catalog_data_source."
6+
---
7+
8+
9+
10+
``analyze_csv(location: str)``
11+
12+
Analyzes an uploaded CSV file in the staging area. Returns column metadata, detected types, preview data, and a config object that can be passed to import_csv.
13+
14+
{{% parameters-block title="Parameters"%}}
15+
16+
{{< parameter p_name="location" p_type="string" >}}
17+
Location string returned by staging_upload.
18+
{{< /parameter >}}
19+
20+
{{% /parameters-block %}}
21+
22+
{{% parameters-block title="Returns"%}}
23+
24+
{{< parameter p_type="AnalyzeCsvResponse" >}}
25+
Analysis result with columns, preview data, and config.
26+
{{< /parameter >}}
27+
28+
{{% /parameters-block %}}
29+
30+
## Example
31+
32+
```python
33+
# Analyze a previously uploaded CSV file
34+
analysis = sdk.catalog_data_source.analyze_csv(location="staging/some-location")
35+
for col in analysis["columns"]:
36+
print(f"{col['name']}: {col['type']}")
37+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "delete_csv_files"
3+
linkTitle: "delete_csv_files"
4+
weight: 193
5+
superheading: "catalog_data_source."
6+
---
7+
8+
9+
10+
``delete_csv_files(data_source_id: str, file_names: list[str])``
11+
12+
Deletes files from a GDSTORAGE data source.
13+
14+
{{% parameters-block title="Parameters"%}}
15+
16+
{{< parameter p_name="data_source_id" p_type="string" >}}
17+
Data source identification string.
18+
{{< /parameter >}}
19+
20+
{{< parameter p_name="file_names" p_type="list[string]" >}}
21+
List of file names to delete.
22+
{{< /parameter >}}
23+
24+
{{% /parameters-block %}}
25+
26+
{{% parameters-block title="Returns" None="yes"%}}
27+
{{% /parameters-block %}}
28+
29+
## Example
30+
31+
```python
32+
# Delete specific files from a GDSTORAGE data source
33+
sdk.catalog_data_source.delete_csv_files(
34+
data_source_id="my-gdstorage-ds",
35+
file_names=["my_table.csv"],
36+
)
37+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "import_csv"
3+
linkTitle: "import_csv"
4+
weight: 192
5+
superheading: "catalog_data_source."
6+
---
7+
8+
9+
10+
``import_csv(data_source_id: str, table_name: str, location: str, config: Optional[dict] = None)``
11+
12+
Imports a CSV file from the staging area into a GDSTORAGE data source.
13+
14+
{{% parameters-block title="Parameters"%}}
15+
16+
{{< parameter p_name="data_source_id" p_type="string" >}}
17+
Data source identification string.
18+
{{< /parameter >}}
19+
20+
{{< parameter p_name="table_name" p_type="string" >}}
21+
Name for the table to create or replace.
22+
{{< /parameter >}}
23+
24+
{{< parameter p_name="location" p_type="string" >}}
25+
Location string returned by staging_upload.
26+
{{< /parameter >}}
27+
28+
{{< parameter p_name="config" p_type="Optional[dict]" >}}
29+
Source config dict, typically from analyze_csv response. Optional.
30+
{{< /parameter >}}
31+
32+
{{% /parameters-block %}}
33+
34+
{{% parameters-block title="Returns" None="yes"%}}
35+
{{% /parameters-block %}}
36+
37+
## Example
38+
39+
```python
40+
# Import a CSV into a GDSTORAGE data source using config from analysis
41+
analysis = sdk.catalog_data_source.analyze_csv(location=location)
42+
config = analysis.to_dict().get("config")
43+
sdk.catalog_data_source.import_csv(
44+
data_source_id="my-gdstorage-ds",
45+
table_name="my_table",
46+
location=location,
47+
config=config,
48+
)
49+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "staging_upload"
3+
linkTitle: "staging_upload"
4+
weight: 190
5+
superheading: "catalog_data_source."
6+
---
7+
8+
9+
10+
``staging_upload(csv_file: Path)``
11+
12+
Uploads a CSV file to the staging area and returns a location string that can be used in subsequent calls to analyze_csv and import_csv.
13+
14+
{{% parameters-block title="Parameters"%}}
15+
16+
{{< parameter p_name="csv_file" p_type="Path" >}}
17+
Path to the CSV file to upload.
18+
{{< /parameter >}}
19+
20+
{{% /parameters-block %}}
21+
22+
{{% parameters-block title="Returns"%}}
23+
24+
{{< parameter p_type="string" >}}
25+
Location string referencing the uploaded file in staging.
26+
{{< /parameter >}}
27+
28+
{{% /parameters-block %}}
29+
30+
## Example
31+
32+
```python
33+
from pathlib import Path
34+
35+
# Upload a CSV file to staging
36+
location = sdk.catalog_data_source.staging_upload(csv_file=Path("data.csv"))
37+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "upload_csv"
3+
linkTitle: "upload_csv"
4+
weight: 194
5+
superheading: "catalog_data_source."
6+
---
7+
8+
9+
10+
``upload_csv(data_source_id: str, csv_file: Path, table_name: str)``
11+
12+
Convenience method that uploads a CSV file and imports it into a GDSTORAGE data source in a single call. Orchestrates the full flow: staging_upload → analyze_csv → import_csv → register_upload_notification.
13+
14+
{{% parameters-block title="Parameters"%}}
15+
16+
{{< parameter p_name="data_source_id" p_type="string" >}}
17+
Data source identification string for a GDSTORAGE data source.
18+
{{< /parameter >}}
19+
20+
{{< parameter p_name="csv_file" p_type="Path" >}}
21+
Path to the CSV file to upload.
22+
{{< /parameter >}}
23+
24+
{{< parameter p_name="table_name" p_type="string" >}}
25+
Name for the table to create or replace in the data source.
26+
{{< /parameter >}}
27+
28+
{{% /parameters-block %}}
29+
30+
{{% parameters-block title="Returns" None="yes"%}}
31+
{{% /parameters-block %}}
32+
33+
## Example
34+
35+
```python
36+
from pathlib import Path
37+
38+
# Upload a CSV file end-to-end in a single call
39+
sdk.catalog_data_source.upload_csv(
40+
data_source_id="my-gdstorage-ds",
41+
csv_file=Path("data.csv"),
42+
table_name="my_table",
43+
)
44+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# NOTE: This file is auto generated by OpenAPI Generator.
2+
# URL: https://openapi-generator.tech
3+
#
4+
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5+
6+
name: gooddata_api_client Python package
7+
8+
on: [push, pull_request]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
pip install -r test-requirements.txt
29+
- name: Test with pytest
30+
run: |
31+
pytest --cov=gooddata_api_client

0 commit comments

Comments
 (0)