from utils.rc.client.requests import Requests
from utils.rc.client.auth import AuthClient
from utils.rc.dtos.project import Project
from utils.rc.dtos.dataset import Dataset
from utils.rc.dtos.dataSource import DataSource
from utils.rc.dtos.dataSource import DataSourceType
from utils.rc.dtos.dataSource import GcpConfig
from utils.notebookhelpers.gcs import GCSHelper
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
Get your GCP Access key json from Rapidcanvas and save it locally
### Get your GCP Access key json and the cloud bucket name from Rapidcanvas and save it locally
gcp_key_path = "/yourlocalpath/gcloud_bucket_cred.json"
gcp_bucket_name = "your_bucket_root"
gcs_helper.download_file('transactions_dataset/transactions.csv', './data' )
#optionally to delete it
#gcs_helper.delete_file('transactions_dataset/transactions.csv')
gcp_remote_filepath_trx = "transactions_dataset/transactions.csv"
# Create dataset in RC using the remote cloud bucket csv file
raw_data = project.addDataset(
dataset_name="transactions",
dataset_description="transactions",
data_source_id=dataSource.id,
data_source_options={GcpConfig.FILE_PATH: gcp_remote_filepath_trx} #saving output with csv input in recipe not working properly
)
#project.deleteDataset(raw_data.id)