-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.py
More file actions
42 lines (33 loc) · 1.54 KB
/
upload.py
File metadata and controls
42 lines (33 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pandas as pd
import oci
# I am going to demonstrate working with Oracle's Cloud Service, more specifically,
# Object Storage. I will be uploading a sample piece of data from the data that we
# previously created and manipulated. Initially, I attempted to upload the entire dataset
# however, it is too large, presumably due to me using the free tier.
# Firstly, we must build our configuration settings. This can be done in an alternative way by
# using a config file, however, I prefer the more explicit dictionary method.
# Side note: if you are interested in working with Oracle yourself, if you navigate to the API Key
# Generation page and create a new key, the subsequent popup will provide you with most of this information
# below. I personally found this much easier than digging through the website for the information.
tenancy = "REDACTED" # Replace REDACTED with correct information
user = "REDACTED" # ''
key_path = "REDACTED" # ''
fingerprint = "REDACTED" # ''
# Build the dictionary
config = {
"user": user,
"key_file": key_path,
"fingerprint": fingerprint,
"tenancy": tenancy,
"region": "us-ashburn-1"
}
# Validate the configuration
validate_config = oci.config.validate_config(config)
# Create our client
client = oci.object_storage.ObjectStorageClient(config)
# Read in the data we want to send
data = pd.read_csv("fixedData.csv")
# Get a smaller sample
sampleData = data.head(1000)
# Send it to the Cloud!
client.put_object("idijgx3cir5f", "data", "SampleData.csv", sampleData.to_csv(index=False))