From the course: Data Science on Google Cloud Platform: Exploratory Data Analytics

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Reading objects from a bucket

Reading objects from a bucket - Google Cloud Tutorial

From the course: Data Science on Google Cloud Platform: Exploratory Data Analytics

Start my 1-month free trial

Reading objects from a bucket

- [Tutor] In this video, I will show you how to read the contents of an object from a Cloud Storage bucket into a Python variable. We can do this using the command line of the SDK. The command to use in the command line is the read command. Then you specify the object to read, including its full Google Cloud Storage URL. You also specify a variable name, into which you want this object to be read. This is a Python variable. Once the read is complete, we can print the type of the variable, and its contents too. We can then use other Python capabilities, to work further on the string object. We can also read it using the SDK. We first create a read bucket object, by specifying the bucket name. Then using this read bucket object, we read the object called data/normal ranges.CSV into the read object. We then use the read stream from the read object to read the contents of this file, into a normal string variable called read text. When we print read texts, it prints the contents of the CSV…

Contents