Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please decode data type to corresponding python data type #281

Closed
c0b opened this issue Sep 22, 2016 · 5 comments
Closed

please decode data type to corresponding python data type #281

c0b opened this issue Sep 22, 2016 · 5 comments
Assignees
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@c0b
Copy link

c0b commented Sep 22, 2016

the bq tool is an app from google cloud SDK, which is using this library

$ bq --apilog - query --use_legacy_sql=false 'SELECT 1 AS a'

INFO:root:user-agent: google-api-python-client/1.3.1 (gzip)

INFO:root:{
 "kind": "bigquery#getQueryResultsResponse",
 "etag": "\"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"",
 "schema": {
  "fields": [
   {
    "name": "a",
    "type": "INTEGER",
    "mode": "NULLABLE"
   }
  ]
 },
 "jobReference": {
  "projectId": "XXXXXXXXX",
  "jobId": "bqjob_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
 },
 "totalRows": "1",
 "rows": [
  {
   "f": [
    {
     "v": "1"
    }
   ]
  }
 ],
 "totalBytesProcessed": "0",
 "jobComplete": true,
 "cacheHit": true
}

INFO:root:--response-end--
[
  {
    "a": "1"
  }
]

#### similar query for `SELECT 1 AS a, 2.3 AS b`

 "schema": {
  "fields": [
   {
    "name": "a",
    "type": "INTEGER",
    "mode": "NULLABLE"
   },
   {
    "name": "b",
    "type": "FLOAT",
    "mode": "NULLABLE"
   }
  ]
 },

 "totalRows": "1",
 "rows": [
  {
   "f": [
    {
     "v": "1"
    },
    {
     "v": "2.3"
    }
   ]
  }
 ],

 "totalBytesProcessed": "0",
 "jobComplete": true,
 "cacheHit": false
}

INFO:root:--response-end--
[
  {
    "a": "1", 
    "b": "2.3"
  }
]

with schema from the api output, you can do more to decode each value into its correct data type: from "1" to INTEGER 1:

expected output

  {
    "a": 1, 
    "b": 2.3
  }
@c0b
Copy link
Author

c0b commented Nov 1, 2016

is this @google-api-python-client project in well maintained?

@mattwhisenhunt
Copy link
Contributor

@c0b it is being maintained, now more-so than in the past. We have limited resources dedicated to it so feature requests such as this one are low priority at the moment.

@JustinBeckwith JustinBeckwith added 🚨 This issue needs some love. triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed status: enhancement triage me I really want to be triaged. labels Jun 8, 2018
@JustinBeckwith JustinBeckwith removed the 🚨 This issue needs some love. label Jun 25, 2018
@busunkim96
Copy link
Contributor

@c0b, thank you for filing an issue! I'm opting to close this as it's unlikely we will implement it in the future.

These client libraries are officially supported by Google. However, the libraries are considered complete and are in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.

@c0b
Copy link
Author

c0b commented Jun 11, 2019

but is there alternative library still taking new features development?

@busunkim96
Copy link
Contributor

busunkim96 commented Jun 11, 2019

Hi @c0b. It looks like you're using BigQuery. We'd recommend using the newer client under active development.

https://github.com/googleapis/google-cloud-python/tree/master/bigquery
https://pypi.org/project/google-cloud-bigquery/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants