GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Preserve order in BigQuery JSON · Issue #2353 · googleapis/google-cloud-python

Preserve order in BigQuery JSON #2353

New issue
Copy link
New issue
Copy link
Closed
Closed
Preserve order in BigQuery JSON#2353
Copy link
Assignees
lukesneeringer
Labels
api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.

Description

@dhermes
dhermes
opened on Sep 19, 2016
Issue body actions

See #2342. Can be done using json.loads(..., object_pairs_hook=OrderedDict) h/t to @c0b

  • It's unclear if any methods "need" this behavior.
  • It's nice that we don't support Python 2.6 any more because collections.OrderedDict was introduced in 2.7
  • If this "feature" is actually worth it, we should determine which subset of payloads need this behavior

Here are all the call sites where JSON is parsed from a string to a Python dictionary:

$ git grep -n 'json.loads(' -- google/cloud/bigquery/
google/cloud/bigquery/table.py:961:        return client.job_from_resource(json.loads(response_content))
$
$ git grep -n 'api_request' -- google/cloud/bigquery/
google/cloud/bigquery/client.py:105:        resp = self.connection.api_request(method='GET', path=path,
google/cloud/bigquery/client.py:148:        resp = self.connection.api_request(method='GET', path=path,
google/cloud/bigquery/client.py:239:        resp = self.connection.api_request(method='GET', path=path,
google/cloud/bigquery/dataset.py:424:        api_response = client.connection.api_request(
google/cloud/bigquery/dataset.py:445:            client.connection.api_request(method='GET', path=self.path,
google/cloud/bigquery/dataset.py:465:        api_response = client.connection.api_request(
google/cloud/bigquery/dataset.py:504:        api_response = client.connection.api_request(
google/cloud/bigquery/dataset.py:520:        api_response = client.connection.api_request(
google/cloud/bigquery/dataset.py:536:        client.connection.api_request(method='DELETE', path=self.path)
google/cloud/bigquery/dataset.py:569:        resp = connection.api_request(method='GET', path=path,
google/cloud/bigquery/job.py:318:        api_response = client.connection.api_request(
google/cloud/bigquery/job.py:339:            client.connection.api_request(method='GET', path=self.path,
google/cloud/bigquery/job.py:359:        api_response = client.connection.api_request(
google/cloud/bigquery/job.py:376:        api_response = client.connection.api_request(
google/cloud/bigquery/query.py:335:        api_response = client.connection.api_request(
google/cloud/bigquery/query.py:392:        response = client.connection.api_request(method='GET',
google/cloud/bigquery/table.py:28:from google.cloud.streaming.http_wrapper import make_api_request
google/cloud/bigquery/table.py:490:        api_response = client.connection.api_request(
google/cloud/bigquery/table.py:511:            client.connection.api_request(method='GET', path=self.path,
google/cloud/bigquery/table.py:531:        api_response = client.connection.api_request(
google/cloud/bigquery/table.py:605:        api_response = client.connection.api_request(
google/cloud/bigquery/table.py:621:        api_response = client.connection.api_request(
google/cloud/bigquery/table.py:637:        client.connection.api_request(method='DELETE', path=self.path)
google/cloud/bigquery/table.py:681:        response = client.connection.api_request(method='GET',
google/cloud/bigquery/table.py:767:        response = client.connection.api_request(
google/cloud/bigquery/table.py:955:            http_response = make_api_request(connection.http, request,
$
$ # current hash
$ git log -1 --pretty=%H
d3e28ce8ae5bee1a637a11d11227d294cfa8302c

Activity

  1. dhermes
    added
    type: questionRequest for information or clarification. Not an issue.
    api: bigqueryIssues related to the BigQuery API.
    on Sep 19, 2016
  2. c0b commented on Sep 19, 2016

    @c0b
    c0b
    on Sep 19, 2016
    More actions

    #2342 (comment)

    please fix your internal bq tool in the google cloud SDK. or I would say anyone here want that prettyjson format would like the keys in preserved order

  3. dhermes commented on Sep 20, 2016

    @dhermes
    dhermes
    on Sep 20, 2016
    ContributorAuthor
    More actions

    The maintainers of this repo don't have any pull with the maintainers of gcloud SDK (I don't even know who they are). So we can't get them fixed there.

    Is it OK if we close this out @c0b? You can file an issue with them at https://code.google.com/p/google-cloud-sdk/issues/list

  4. c0b commented on Sep 20, 2016

    @c0b
    c0b
    on Sep 20, 2016
    More actions

    or I would say anyone here want that prettyjson format would like the keys in preserved order

    users of this library would like to see a preserved keys order option; this is still a valid enhancement request

  5. dhermes commented on Sep 20, 2016

    @dhermes
    dhermes
    on Sep 20, 2016
    ContributorAuthor
    More actions

    Which users?

  6. c0b commented on Sep 22, 2016

    @c0b
    c0b
    on Sep 22, 2016
    More actions

    users of this library

  7. dhermes commented on Sep 22, 2016

    @dhermes
    dhermes
    on Sep 22, 2016
    ContributorAuthor
    More actions

    What I mean to say is that we haven't heard the request from anyone but you and from your previous comments it doesn't seem like you use this library?

  8. c0b commented on Sep 22, 2016

    @c0b
    c0b
    on Sep 22, 2016
    More actions

    I am a potential one, if the library is made really good to use; right now #2354 is a blocker to me, because I have been using Standard SQL nested fields a lot; that is a must fix; but this one is a feature nice to have:

    can I request API design like this?

    >>> query = client.run_query('SELECT ...', use_legacy_sql=False, use_ordered_dict=True)
    >>> query.run()
    >>> for row in query.rows:
                 ...
  9. lukesneeringer
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Apr 19, 2017
  10. lukesneeringer commented on Aug 11, 2017

    @lukesneeringer
    lukesneeringer
    on Aug 11, 2017
    Contributor
    More actions

    Hello,
    One of the challenges of maintaining a large open source project is that sometimes, you can bite off more than you can chew. As the lead maintainer of google-cloud-python, I can definitely say that I have let the issues here pile up.

    As part of trying to get things under control (as well as to empower us to provide better customer service in the future), I am declaring a "bankruptcy" of sorts on many of the old issues, especially those likely to have been addressed or made obsolete by more recent updates.

    My goal is to close stale issues whose relevance or solution is no longer immediately evident, and which appear to be of lower importance. I believe in good faith that this is one of those issues, but I am scanning quickly and may occasionally be wrong. If this is an issue of high importance, please comment here and we will reconsider. If this is an issue whose solution is trivial, please consider providing a pull request.

    Thank you!

  11. lukesneeringer
    closed this as completedon Aug 11, 2017
  12. JustinBeckwith
    assigned
    lukesneeringer
    on Feb 1, 2021
  13. parthea
    added a commit that references this issue on Oct 21, 2023

    chore: move samples from python-docs-sample (#45)

    d369a34
  14. parthea
    added a commit that references this issue on Nov 24, 2025

    chore(main): release 1.23.5 (#2353)

    b4cd728
  15. parthea
    added a commit that references this issue on Apr 1, 2026

    refactor: Anywidget Table Styling and Hover Enhancements (#2353)

    8a788bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lukesneeringer
    lukesneeringer

Labels

api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.