Skip to content

bigquery: timestamp return format is off #2479

@kwent

Description

@kwent

Hi,

Issue: I'm not sure timestamp type are detected correctly and returned with the right format.

Google BigQuery Console is good:

screen shot 2017-07-20 at 10 26 24 pm

Just to validate the type of time_ts, here is the schema:

screen shot 2017-07-20 at 10 29 47 pm

NodeJS output

var bigquery = require('@google-cloud/bigquery');
const conn = bigquery({ credentials });
conn.startQuery('SELECT time_ts FROM [bigquery-public-data:hacker_news.comments] LIMIT 3', (queryErr, job) => {
  if (queryErr) reject(queryErr);
  job.getQueryResults((resultErr, rows) => {
    console.log('rows', rows);
    // Output:
    // rows [ { time_ts: { value: '2015-04-24 12:05:51.000' } },
    // { time_ts: { value: '2014-11-04 16:32:25.000' } },
    // { time_ts: { value: '2012-05-18 14:12:15.000' } } ]
  });
});

Why in the response, the timestamp is wrapped in a object with value as attribute ? Is this expected ?

Should not it be: { time_ts: '2015-04-24 12:05:51.000' } ?

I suspect something going wrong and this line being executed:

https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/bigquery/src/index.js#L328

Environment details

  • OS: macOS
  • Node.js version: 7.2.0
  • npm version: 3.10.9
  • google-cloud-node version: 0.9.6

Regards

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions