Google-cloud-node: Can I specify big query table table decorators using this library ?

Created on 27 Jun 2017  路  8Comments  路  Source: googleapis/google-cloud-node

Hi,

In this page https://cloud.google.com/bigquery/streaming-data-into-bigquery it is specified that i need to use
this syntax table$20170301 to stream to a custom partition. Is is available in this library ?

question bigquery

All 8 comments

Yes, it should work. Have you tried?

I have no idea how to do that!
using get https://googlecloudplatform.github.io/google-cloud-node/#/docs/bigquery/0.9.2/bigquery/table?method=get with a tableId+partition as id?

Haha, let's figure it out! I think you just need to reference a table like:

var bigquery = require('@google-cloud/bigquery')({...})
var table = bigquery.table('table$20170301')

Let me know if this works.

Gotta wait the streamingBuffer flush... I'll keep it you updated!

Thanks :)

Back with infos!

So the decorator things works! However I ran into another issue, the insertId example in the docs yields this error:

{
   "errors": [
      {
         "errors": [
            {
               "message": "no such field.",
               "reason": "invalid"
            }
         ]
      }
   ],
   "response": {
      "kind": "bigquery#tableDataInsertAllResponse",
      "insertErrors": [
         {
            "index": 0,
            "errors": [
               {
                  "reason": "invalid",
                  "location": "json",
                  "debugInfo": "generic::not_found: no such field.",
                  "message": "no such field."
               }
            ]
         }
      ]
   },
   "message": "A failure occurred during this request."
}

The format I'm giving to insert is this:

{
  insertId: shortid.generate(),
  json: data,
}

Query is valid because when I use this it inserts without problems

{
...data
}

(reference: https://googlecloudplatform.github.io/google-cloud-node/#/docs/bigquery/0.9.2/bigquery/table?method=insert)

@stephenplusplus Did you get a chance to see this?

It sounds like maybe the options object specifying a raw request wasn't used:

var row = {
  insertId: '1',
  json: {
    INSTNM: 'Motion Picture Institute of Michigan',
    CITY: 'Troy',
    STABBR: 'MI'
  }
};

var options = {
  raw: true
};

table.insert(row, options, insertHandler);

That's it worked! Silly me.. Thanks for your help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

charly37 picture charly37  路  3Comments

nicolasgarnier picture nicolasgarnier  路  4Comments

sabrehagen picture sabrehagen  路  4Comments

arbesfeld picture arbesfeld  路  4Comments

sporkd picture sporkd  路  5Comments