Skip to content

BigQuery - "dataset.createTable" doesn't support schema as array #1196

@jmdobry

Description

@jmdobry

This works:

dataset.createTable(tableName, {
  schema: 'Name:STRING,Age:INTEGER,Weight:FLOAT,IsMagic:BOOLEAN'
}, callback);

Based on the docs:

Schemas can also be specified as a JSON array of fields, which allows for nested and repeated fields. See a Table resource for more detailed information.

Shouldn't this work? (It doesn't as far as I can tell, table is created without a schema.)

dataset.createTable(tableName, {
  schema: [
    {
      "type": "STRING",
      "name": "Name"
    },
    {
      "type": "INTEGER",
      "name": "Age"
    },
    {
      "type": "FLOAT",
      "name": "Weight"
    },
    {
      "type": "BOOLEAN",
      "name": "IsMagic"
    }
  ]
}, callback);

Perhaps I missed something.

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions