Skip to content

Commit

Permalink
Add --compression to export-jobs subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
tomach committed Jul 17, 2023
1 parent ba46c0e commit 8041764
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions croud/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,13 @@
choices=["csv", "json", "parquet"],
help="The format of the data in the file.",
),
Argument(
"--compression",
type=str,
required=False,
choices=["gzip"],
help="The compression method of the exported file.",
),
Argument(
"--save-as",
type=str,
Expand Down
3 changes: 3 additions & 0 deletions croud/clusters/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ def export_jobs_create(args: Namespace) -> None:
"destination": {"format": args.file_format},
}

if args.compression:
body["compression"] = args.compression

client = Client.from_args(args)
data, errors = client.post(
f"/api/v2/clusters/{args.cluster_id}/export-jobs/", body=body
Expand Down
3 changes: 3 additions & 0 deletions tests/commands/test_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,8 @@ def test_export_job_create(mock_client_request, mock_copy, save_file):
"csv",
"--table",
"my-table",
"--compression",
"gzip",
)
if save_file:
cmd = cmd + (
Expand All @@ -1762,6 +1764,7 @@ def test_export_job_create(mock_client_request, mock_copy, save_file):
"table": "my-table",
},
"destination": {"format": "csv"},
"compression": "gzip",
}
assert_rest(
mock_client_request,
Expand Down

0 comments on commit 8041764

Please sign in to comment.