Skip to content

Commit

Permalink
spanner: promote to beta (googleapis#2452)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus authored Jul 17, 2017
1 parent 88b18ae commit 2c19dd1
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 89 deletions.
163 changes: 82 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This client supports the following Google Cloud Platform services at a [General
This client supports the following Google Cloud Platform services at a [Beta](#versioning) quality level:

* [Cloud Natural Language](#cloud-natural-language-beta) (Beta)
* [Cloud Spanner](#cloud-spanner-beta) (Beta)
* [Cloud Vision](#cloud-vision-beta) (Beta)
* [Google BigQuery](#google-bigquery-beta) (Beta)

Expand All @@ -29,7 +30,6 @@ This client supports the following Google Cloud Platform services at an [Alpha](
* [Cloud DNS](#cloud-dns-alpha) (Alpha)
* [Cloud Pub/Sub](#cloud-pubsub-alpha) (Alpha)
* [Cloud Resource Manager](#cloud-resource-manager-alpha) (Alpha)
* [Cloud Spanner](#cloud-spanner-alpha) (Alpha)
* [Cloud Speech](#cloud-speech-alpha) (Alpha)
* [Google Compute Engine](#google-compute-engine-alpha) (Alpha)
* [Google Prediction API](#google-prediction-api-alpha) (Alpha)
Expand Down Expand Up @@ -530,6 +530,87 @@ document.annotate(function(err, annotation) {
```


## Cloud Spanner (Beta)

- [API Documentation][gcloud-spanner-docs]
- [Official Documentation][cloud-spanner-docs]

#### Using the Cloud Spanner API module

```
$ npm install --save @google-cloud/spanner
```

```js
var spanner = require('@google-cloud/spanner');
```

#### Preview

```js
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).

var spannerClient = spanner({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});

var instance = spannerClient.instance('my-instance');
var database = instance.database('my-database');

// Create a table.
var schema = `
CREATE TABLE Singers (
SingerId INT64 NOT NULL,
FirstName STRING(1024),
LastName STRING(1024),
SingerInfo BYTES(MAX),
) PRIMARY KEY(SingerId)
`;

database.createTable(schema, function(err, table, operation) {
if (err) {
// Error handling omitted.
}

operation
.on('error', function(err) {})
.on('complete', function() {
// Table created successfully.
});
});

// Insert data into the table.
var table = database.table('Singers');

table.insert({
SingerId: 10,
FirstName: 'Eddie',
LastName: 'Wilson'
}, function(err) {
if (!err) {
// Row inserted successfully.
}
});

// Run a query as a readable object stream.
database.runStream('SELECT * FROM Singers')
.on('error', function(err) {})
.on('data', function(row) {
// row.toJSON() = {
// SingerId: 10,
// FirstName: 'Eddie',
// LastName: 'Wilson'
// }
}
})
.on('end', function() {
// All results retrieved.
});
```


## Cloud Vision (Beta)

- [API Documentation][gcloud-vision-docs]
Expand Down Expand Up @@ -891,86 +972,6 @@ project.getMetadata(function(err, metadata) {
```


## Cloud Spanner (Alpha)

- [API Documentation][gcloud-spanner-docs]
- [Official Documentation][cloud-spanner-docs]

#### Using the Cloud Spanner API module

```
$ npm install --save @google-cloud/spanner
```

```js
var spanner = require('@google-cloud/spanner');
```

#### Preview

```js
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).

var spannerClient = spanner({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});

var instance = spannerClient.instance('my-instance');
var database = instance.database('my-database');

// Create a table.
var schema =
'CREATE TABLE Singers (' +
' SingerId INT64 NOT NULL,' +
' FirstName STRING(1024),' +
' LastName STRING(1024),' +
' SingerInfo BYTES(MAX),' +
') PRIMARY KEY(SingerId)';

database.createTable(schema, function(err, table, operation) {
if (err) {
// Error handling omitted.
}

operation
.on('error', function(err) {})
.on('complete', function() {
// Table created successfully.
});
});

// Insert data into the table.
var table = database.table('Singers');

table.insert({
SingerId: 10,
FirstName: 'Eddie',
LastName: 'Wilson'
}, function(err) {
if (!err) {
// Row inserted successfully.
}
});

// Run a query as a readable object stream.
database.runStream('SELECT * FROM Singers')
.on('error', function(err) {})
.on('data', function(row) {
// row.toJSON() = {
// SingerId: 10,
// FirstName: 'Eddie',
// LastName: 'Wilson'
// }
}
})
.on('end', function() {
// All results retrieved.
});
```


## Cloud Speech (Alpha)

- [API Documentation][gcloud-speech-docs]
Expand Down
17 changes: 9 additions & 8 deletions packages/spanner/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @google-cloud/spanner ([Alpha][versioning])
# @google-cloud/spanner ([Beta][versioning])
> Cloud Spanner Client Library for Node.js
*Looking for more Google APIs than just Cloud Spanner? You might want to check out [`google-cloud`][google-cloud].*
Expand All @@ -20,13 +20,14 @@ var instance = spanner.instance('my-instance');
var database = instance.database('my-database');

// Create a table.
var schema =
'CREATE TABLE Singers (' +
' SingerId INT64 NOT NULL,' +
' FirstName STRING(1024),' +
' LastName STRING(1024),' +
' SingerInfo BYTES(MAX),' +
') PRIMARY KEY(SingerId)';
var schema = `
CREATE TABLE Singers (
SingerId INT64 NOT NULL,
FirstName STRING(1024),
LastName STRING(1024),
SingerInfo BYTES(MAX),
) PRIMARY KEY(SingerId)
`;

database.createTable(schema, function(err, table, operation) {
if (err) {
Expand Down

0 comments on commit 2c19dd1

Please sign in to comment.