Skip to content

Commit

Permalink
Merge pull request #264 from stephenplusplus/spp--bigquery
Browse files Browse the repository at this point in the history
BigQuery
  • Loading branch information
silvolu committed Oct 31, 2014
2 parents ecd25f2 + 147d8fb commit 225cb06
Show file tree
Hide file tree
Showing 20 changed files with 4,520 additions and 29 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,46 @@ If you are not running this client on Google Compute Engine, you need a Google D
* If you want to use a new service account, click on **Create new client ID**. After the account is created, you will be prompted to download the JSON key file that the library uses to authorize your requests.
* If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file.

## Google BigQuery

Analyze Big Data in the cloud with [Google BigQuery][cloud-bigquery] ([docs][cloud-bigquery-docs]) . Run fast, SQL-like queries against multi-terabyte datasets in seconds. Scalable and easy to use, BigQuery gives you real-time insights about your data.

See the [gcloud-node BigQuery API documentation][gcloud-bigquery-docs] to learn how to access your BigQuery datasets using this library.

```js
var gcloud = require('gcloud');
var bigquery;

// From Google Compute Engine:
bigquery = gcloud.bigquery({
projectId: 'my-project'
});

// Or from elsewhere:
bigquery = gcloud.bigquery({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json'
});

// Access an existing dataset.
var schoolsDataset = bigquery.dataset('schools');

// Import data into a dataset.
schoolsDataset.import('/local/file.json', function(err, job) {});

// Get results from a query job.
bigquery.job('job-id').getQueryResults(function(err, rows, nextQuery) {});

// Get the same results as a readable stream.
bigquery.job('job-id')
.getQueryResults()
.pipe(require('through2').obj(function(row, enc, next) {
this.push(row.address + '\n');
next();
}))
.pipe(process.stdout);
```

## Google Cloud Datastore

[Google Cloud Datastore][cloud-datastore] ([docs][cloud-datastore-docs]) is a fully managed, schemaless database for storing non-relational data. Cloud Datastore automatically scales with your users and supports ACID transactions, high availability of reads and writes, strong consistency for reads and ancestor queries, and eventual consistency for all other queries.
Expand Down Expand Up @@ -165,6 +205,7 @@ Apache 2.0 - See [COPYING](COPYING) for more information.

[gcloud-homepage]: https://googlecloudplatform.github.io/gcloud-node
[gcloud-docs]: https://googlecloudplatform.github.io/gcloud-node/#/docs
[gcloud-bigquery-docs]: https://googlecloudplatform.github.io/gcloud-node/#/docs/bigquery
[gcloud-datastore-docs]: https://googlecloudplatform.github.io/gcloud-node/#/docs/datastore
[gcloud-pubsub-docs]: https://googlecloudplatform.github.io/gcloud-node/#/docs/pubsub
[gcloud-storage-docs]: https://googlecloudplatform.github.io/gcloud-node/#/docs/storage
Expand All @@ -175,6 +216,9 @@ Apache 2.0 - See [COPYING](COPYING) for more information.

[googleapis]: https://github.com/google/google-api-nodejs-client

[cloud-bigquery]: https://cloud.google.com/bigquery
[cloud-bigquery-docs]: https://cloud.google.com/bigquery/what-is-bigquery

[cloud-datastore]: https://cloud.google.com/products/cloud-datastore
[cloud-datastore-docs]: https://developers.google.com/datastore
[cloud-datastore-activation]: https://developers.google.com/datastore/docs/activate
Expand Down
23 changes: 22 additions & 1 deletion docs/components/docs/docs-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ angular.module('gcloud.docs')
_url: '{baseUrl}'
},

bigquery: {
title: 'BigQuery',
_url: '{baseUrl}/bigquery',
pages: [
{
title: 'Dataset',
url: '/dataset'
},
{
title: 'Job',
url: '/job'
},
{
title: 'Table',
url: '/table'
}
]
},

datastore: {
title: 'Datastore',
_url: '{baseUrl}/datastore',
Expand Down Expand Up @@ -114,6 +133,8 @@ angular.module('gcloud.docs')
'<0.9.0': ['storage'],

// introduce new storage api.
'>=0.9.0': ['storageWithFiles']
'>=0.9.0': ['storageWithFiles'],

'>=0.10.0': ['bigquery']
}
});
12 changes: 12 additions & 0 deletions docs/components/docs/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ <h3 class="sub-heading">
</article>
<hr>

<article ng-if="isActiveDoc('bigquery')">
<h3>BigQuery Overview</h3>
<p>
The object returned from <code>gcloud.bigquery</code> gives you complete access to and control of your BigQuery datasets. You can work with existing ones, by using the <code>dataset</code> method, or create new ones with <code>createDataset</code>.
</p>
<div hljs>
var bigquery = gcloud.bigquery();</div>
<p>
Follow along with the examples below to see how to query your datasets, create tables, import data from your Cloud Storage buckets, and more.
</p>
</article>

<article ng-if="isActiveDoc('datastore')">
<h3>Datastore Overview</h3>
<p>
Expand Down
27 changes: 24 additions & 3 deletions docs/components/docs/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ angular
matches.push(formatHtml(detectLinks(detectModules(
block.trim()
.replace(/\/\/-*\s*/g, '\n')
.replace(/(https*:)\W*/g, '$1//')
.replace(/\n\n/g, '\n')
.replace(/(\w)\n(\w)/g, '$1 $2')
.replace(/\n\n/g, '</p><p>')
Expand All @@ -46,12 +47,24 @@ angular
}
function detectLinks(str) {
var regex = {
normal: /{@link ([^}]*)}/g,
normalWithTitle: /\[([^\]]*)]{@link ([^}]*)}/g,
withCode: /{@linkcode <a href="([^\"]*)">([^<]*)<\/a>/g,
withTitle: /\[([^\]]*)]{@link <a href="([^}]*)}">[^}]*}<\/a>/g,
withoutTitle: /{@link <a href="([^}]*)}">[^}]*}<\/a>/g
};
var a = document.createElement('a');
return str
.replace(regex.normalWithTitle, function(match, title, link) {
a.href = link;
a.innerText = title;
return a.outerHTML;
})
.replace(regex.normal, function(match, link) {
a.href = link;
a.innerText = link;
return a.outerHTML;
})
.replace(regex.withTitle, function(match, title, link) {
a.href = link;
a.innerText = title;
Expand Down Expand Up @@ -90,7 +103,15 @@ angular
});
}
function reduceModules(acc, type, index, types) {
var CUSTOM_TYPES = ['query', 'dataset', 'transaction', 'bucket', 'file'];
var CUSTOM_TYPES = [
'query',
'dataset',
'transaction',
'bucket',
'file',
'job',
'table'
];
type = type.replace('=', '');
if (CUSTOM_TYPES.indexOf(type.toLowerCase()) > -1) {
if (types[index - 1]) {
Expand Down Expand Up @@ -123,7 +144,7 @@ angular
})
.map(function(tag) {
tag.description = $sce.trustAsHtml(
formatHtml(tag.description.replace(/^- /, '')));
formatHtml(detectLinks(tag.description.replace(/^- /, ''))));
tag.types = $sce.trustAsHtml(tag.types.reduceRight(
reduceModules, []).join(', '));
tag.optional = tag.types.toString().indexOf('=') > -1;
Expand Down Expand Up @@ -216,7 +237,7 @@ angular
}

function compareMethods(a, b) {
return a.constructor ? -1: a.name > b.name;
return a.constructor ? -1: a.name > b.name ? 1 : -1;
}

function getLinks($route, getLinks) {
Expand Down
Empty file.
Loading

0 comments on commit 225cb06

Please sign in to comment.