Skip to content

Converting result set to simple types #1489

@spock123

Description

@spock123

Whenever results from queries come back, we usually get complex types (classes) for timestamps, decimals, dates etc. It's a big problem for us to convert those values into simple values.

Would it be an idea to have a flag in the query request, that performs this conversion?

As an example, decimals are returned like this

price: Big { s: 1, e: 0, c: [Array], constructor: [Function] },

We can't even use a generic function to call .toString() on these values, because then the values are represented as strings, not decimals, creating potential issues.

What do you guys do to generically handle this issue?
It's a huge problem for queries, and I'm quite surprised not more people are discussing this (I googled).

thoughts?

Cheers

What would you like to see in the library?

A flag in queries that forces conversion to simple types

Describe alternatives you've considered

Creating recursive functions to parse result but it's not ideal and doesn't work well. toString() converts to a string, even for decimals for example.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/nodejs-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions