I am trying to open a csv file which is present in gcs bucket to read the content and process the data accordingly in BigQuery. I am able to list out the csv's present in bucket , but not able to open it . My code is as below:
with cloudstorage.open(bucket_name/gs_file,"r+") as csvFile:
reader = csv.reader(iter(csvFile.readline,''), delimiter = '|')
csvfilearray = next(reader)
print (csvfilearray)
Getting below error :
NameError: name 'cloudstorage' is not defined
Imported cloudstorage as below:
import cloudstorage as gcs
and tried with gcs.open
again , But still error :
File "./GCS_Connection_Test.py", line 10, in <module>
import cloudstorage as gcs
ImportError: No module named cloudstorage
Can anyone please help on how to open a file present on GCS for processing .