run sample query

97 views
Skip to first unread message

charlie

unread,
Jun 24, 2010, 4:59:36 PM6/24/10
to BigQuery discuss
Hi group,

First I want to thank Amit for granting me access to BigQuery.

I am trying to run a sample query described in "Using cURL with
BigQuery" under "Getting Started" using cURL on a WinNT machine by
following the instructions. I was able to get a token in Step 1. So
far no luck with the sample query in "Making requests" Step 1 though.
cURL command and results shown below (actual token value removed).
Please advise. Thanks!

curl -v -k -H "Authorization: GoogleLogin auth=TOKEN"
https://www.googleapis.com/bigquery/v1/tables/bigquery/samples/shakespeare

* About to connect() to www.googleapis.com port 443 (#0)
* Trying 74.125.95.95... connected
* Connected to www.googleapis.com (74.125.95.95) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc;
CN=*.googl
eapis.com
* start date: 2010-03-05 03:07:47 GMT
* expire date: 2011-03-05 03:17:47 GMT
* subjectAltName: www.googleapis.com matched
* issuer: C=US; O=Google Inc; CN=Google Internet Authority
* SSL certificate verify result: unable to get local issuer
certificate (
20), continuing anyway.
> GET /bigquery/v1/tables/bigquery/samples/shakespeare HTTP/1.1
> User-Agent: curl/7.21.0 (i386-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2
.5
> Host: www.googleapis.com
> Accept: */*
> Authorization: GoogleLogin auth=TOKEN
>
< HTTP/1.1 404 Not Found
< Content-Type: text/html; charset=UTF-8
< Date: Thu, 24 Jun 2010 20:37:16 GMT
< Expires: Thu, 24 Jun 2010 20:37:16 GMT
< Cache-Control: private, max-age=0
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: GSE
< Transfer-Encoding: chunked
<
Not Found* Connection #0 to host www.googleapis.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

Amit Agarwal

unread,
Jun 24, 2010, 5:56:23 PM6/24/10
to bigquery...@googlegroups.com
Hi Charlie,

I think there is a bug in our docs. Can you try the following query.

charlie

unread,
Jun 24, 2010, 6:34:26 PM6/24/10
to BigQuery discuss
Thanks for your reply Amit.

I tried your suggestion. Got a different error message this time
(HTTP/1.1 400 Bad Request). Results below.

I also tried single quotes around the URL and double quotes around the
URL. Neither worked. Not sure how to make a well-formed URL for cURL
under WinNT for use with BigQuery. Has anyone had success with it?

curl -v -k -H "Authorization: GoogleLogin auth=TOKEN"
https://www.googleapis.com/bigquery/v1/tables/bigquery%2Fsamples%2Fshakespeare

* About to connect() to www.googleapis.com port 443 (#0)
* Trying 209.85.225.95... connected
* Connected to www.googleapis.com (209.85.225.95) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc;
CN=*.googl
eapis.com
* start date: 2010-03-05 03:07:47 GMT
* expire date: 2011-03-05 03:17:47 GMT
* subjectAltName: www.googleapis.com matched
* issuer: C=US; O=Google Inc; CN=Google Internet Authority
* SSL certificate verify result: unable to get local issuer
certificate (
20), continuing anyway.
> GET /bigquery/v1/tables/bigqueryFsamplesFshakespeare HTTP/1.1
> User-Agent: curl/7.21.0 (i386-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2
.5
> Host: www.googleapis.com
> Accept: */*
> Authorization: GoogleLogin auth=TOKEN
>
< HTTP/1.1 400 Bad Request
< Content-Type: application/json; charset=UTF-8
< Date: Thu, 24 Jun 2010 22:18:25 GMT
< Expires: Thu, 24 Jun 2010 22:18:25 GMT
< Cache-Control: private, max-age=0
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: GSE
< Transfer-Encoding: chunked
<
{"error":{"errors":[{"message":"Parse Error: Not a valid table
reference","locat
ionType":"other","location":"bigqueryFsamplesFshakespeare"}],"code":
400,"message
":"Parse Error: Not a valid table reference"}}* Connection #0 to host
www.google

Amit Agarwal

unread,
Jun 24, 2010, 7:08:38 PM6/24/10
to bigquery...@googlegroups.com
Trying plain text format this time to see if the escaping works correctly.
curl -H "Authorization: GoogleLogin auth=TOKEN"
'https://www.googleapis.com/bigquery/v1/tables/bigquery%2Fsamples%2Fshakespeare'

Let me know if this works for you.

charlie

unread,
Jun 25, 2010, 10:13:21 AM6/25/10
to BigQuery discuss
Tried that before. Got a different error message (see below). cURL
under Windows doesn't accept a URL with single quotes around it.

Has anyone at Google had success using cURL under Windows with
BigQuery?

Thanks.

command:
C:\Program Files\curl -v -k -H "Authorization: GoogleLogin auth=TOKEN"
'https://www.googleapis.com/bigquery/v1/tables/bigquery%2Fsamples
%2Fshakespeare'

response:
C:\Program Files\cURL>curl -v -k -H "Authorization: GoogleLogin
auth=TOKEN" 'https://www.googleapis.c
om/bigquery/v1/tables/bigqueryFsamplesFshakespeare'
* Protocol 'https not supported or disabled in libcurl
curl: (1) Protocol 'https not supported or disabled in libcurl

charlie

unread,
Jun 25, 2010, 10:53:30 AM6/25/10
to BigQuery discuss
Thanks for your help Amit.

I found the solution in cURL FAQs http://curl.haxx.se/docs/faq.html --

4.2 Why do I get problems when I use & or % in the URL?
...
In Windows, the standard DOS shell treats the %-symbol specially and
you
need to use TWO %-symbols for each single one you want to use in the
URL.
...

Now using

curl -v -k -H "Authorization: GoogleLogin auth=TOKEN" "https://
www.googleapis.com/bigquery/v1/tables/bigquery%%2Fsamples%%2Fshakespeare"

I get

* About to connect() to www.googleapis.com port 443 (#0)
* Trying 74.125.95.95... connected
* Connected to www.googleapis.com (74.125.95.95) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc;
CN=*.googl
eapis.com
* start date: 2010-03-05 03:07:47 GMT
* expire date: 2011-03-05 03:17:47 GMT
* subjectAltName: www.googleapis.com matched
* issuer: C=US; O=Google Inc; CN=Google Internet Authority
* SSL certificate verify result: unable to get local issuer
certificate (
20), continuing anyway.
> GET /bigquery/v1/tables/bigquery%2Fsamples%2Fshakespeare HTTP/1.1
> User-Agent: curl/7.21.0 (i386-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2
.5
> Host: www.googleapis.com
> Accept: */*
> Authorization: GoogleLogin auth=TOKEN
>
< HTTP/1.1 200 OK
< Expires: Fri, 25 Jun 2010 14:48:51 GMT
< Date: Fri, 25 Jun 2010 14:48:51 GMT
< Cache-Control: private, max-age=0, must-revalidate, no-transform
< Content-Type: application/json; charset=UTF-8
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: GSE
< Transfer-Encoding: chunked
<
{"data":{"kind":"bigquery#table","name":"bigquery/samples/
shakespeare","fields":
[{"id":"word_count","type":"int64"},
{"id":"corpus_date","type":"int32"},{"id":"w
ord","type":"string"},{"id":"corpus","type":"string"}]}}* Connection
#0 to host
www.googleapis.com left intact

Amit Agarwal

unread,
Jun 25, 2010, 10:55:43 AM6/25/10
to bigquery...@googlegroups.com
Hi Charlie,

Thanks for debugging this. We will incorporate this in our docs.

thanks
Amit

Reply all
Reply to author
Forward
0 new messages