Hello there,

I am dumping the bid changes made by scripts into bigquery. Is there a way 
to download large amounts of data (>200mb) from bigquery into a csv using 
the python API for bigquery? Below is the sample snippet i am using. I am 
not getting all the 100k rows in the csv. I am only getting like 20k rows. 
Any help would be appreciated.



FLOW = flow_from_clientsecrets('client_secrets.json',
                               scope=
'https://www.googleapis.com/auth/bigquery')
def main():
  storage = Storage('bigquery_credentials.dat')
  credentials = storage.get()
  if credentials is None or credentials.invalid:
    # Run oauth2 flow with default arguments.
    credentials = tools.run_flow(FLOW, storage, tools.argparser.parse_args
([]))
  http = httplib2.Http()
  http = credentials.authorize(http)
  bigquery_service = build('bigquery', 'v2', http=http)
  try:
    query_request = bigquery_service.jobs()
    #table = input()
    query_data = {"query":"SELECT * FROM [Sample.Sample] order by 
update_date limit 100000"}
    
    query_response = query_request.query(projectId=PROJECT_NUMBER,
                                         body=query_data).execute()
    #textfile = open('text.txt','w')
print ('Query Results:')
    for row in query_response['rows']:
      result_row = []
      for field in row['f']:
        result_row.append(field['v'])
      sys.stdout = open('test.txt','a')
      output = str(result_row).replace("[", 
"").replace("]","").replace("'","").encode(encoding='utf_8', 
errors='strict')
      print(str(output).replace("b'", "").replace("'", ""))

Thanks

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/37d8c18a-5501-441f-b870-97ba6f03dd8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to