From 3fc0da79c6dc69a688253a7fb8bdbb0e7a525ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20=C3=85mdal?= Date: Fri, 6 Oct 2023 14:26:25 +0200 Subject: [PATCH] PRO-211: Add support for is_private in upload_csv As per https://github.com/duneanalytics/docs/pull/399 , the Dune Upload API now supports uploading private datasets. With this commit, we add this functionality to the upload_csv function. I recognize that this functionality gets inside the "Plus Subscription" section even though it is premium. I decided that this was the best option and cleaner than creating a `upload_csv_private` function. Closes #97. --- dune_client/api/extensions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dune_client/api/extensions.py b/dune_client/api/extensions.py index 918f183..532ef6b 100644 --- a/dune_client/api/extensions.py +++ b/dune_client/api/extensions.py @@ -133,13 +133,20 @@ def download_csv(self, query: Union[QueryBase, str, int]) -> ExecutionResultCSV: ############################ # Plus Subscription Features ############################ - def upload_csv(self, table_name: str, data: str, description: str = "") -> bool: + def upload_csv( + self, + table_name: str, + data: str, + description: str = "", + is_private: bool = False, + ) -> bool: """ https://dune.com/docs/api/api-reference/upload-data/?h=data+upload#endpoint The write API allows you to upload any .csv file into Dune. The only limitations are: - File has to be < 200 MB - Column names in the table can't start with a special character or digits. + - Private uploads require a Premium subscription. Below are the specifics of how to work with the API. """ @@ -149,6 +156,7 @@ def upload_csv(self, table_name: str, data: str, description: str = "") -> bool: "table_name": table_name, "description": description, "data": data, + "is_private": is_private, }, ) try: