Database Reference
In-Depth Information
'load': load
}
},
media_body=media_body).execute()
print json.dumps(result, indent=2)
# Wait for completion.
done = False
while not done:
time.sleep(10)
result = jobs.get(projectId=project_id,
jobId=job_id).execute()
print "%s %ds" % (result['status']['state'],
time.time() - start)
done = result['status']['state'] == 'DONE'
# Print all errors and warnings.
for err in result['status'].get('errors', []):
print json.dumps(err, indent=2)
# Check for failure.
if 'errorResult' in result['status']:
print 'FAILED'
print json.dumps(result['status']['errorResult'],
indent=2)
else:
print 'SUCCESS'
Listing 6.1b : (load.py)
# Sample code authorization support.
import auth
# Functions to help run a load job.
import run_load
def main():
service = auth.build_bq_client()
# Load configuration with the destination specified.
load_config = {
'destinationTable': {
'projectId': auth.PROJECT_ID,
'datasetId': 'ch06',
# You can update this for each example.
 
Search WWH ::




Custom Search