import dotenv, os
from dune_client.client import DuneClient
# change the current working directory where .env file lives
os.chdir("/Users/abc/project")
# load .env file
dotenv.load_dotenv(".env")
# setup Dune Python client
dune = DuneClient.from_env()
# define path to your CSV file
csv_file_path = '<CSV_FILE_PATH>'
with open(csv_file_path) as open_file:
data = open_file.read()
table = dune.upload_csv(
data=str(data),
description="Data about 80 cereals, sourced from https://www.kaggle.com/datasets/crawford/80-cereals",
table_name="cereal_table", # define your table name here
is_private=False
)