Skip to content

Commit

Permalink
PRO-211: Add support for is_private in upload_csv
Browse files Browse the repository at this point in the history
As per duneanalytics/docs#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.
  • Loading branch information
hawkaa committed Oct 6, 2023
1 parent 84b3e94 commit 3fc0da7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dune_client/api/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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:
Expand Down

0 comments on commit 3fc0da7

Please sign in to comment.