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 — `Client.insert_rows_json()`: add option to disable best-effort deduplication · Issue #720 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Client.insert_rows_json(): add option to disable best-effort deduplication #720

Copy link
Copy link
Closed
#734
Closed
Client.insert_rows_json(): add option to disable best-effort deduplication#720
#734
Copy link
Assignees
plamut
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@pietrodn
pietrodn
opened on Jun 25, 2021
Issue body actions

Currently, the Client.insert_rows_json() method for streaming inserts always inserts an insertId unique identifier for each row provided.
This row identifier can be user-provided; if the user doesn't provide any identifiers, the library automatically fills the row IDs by using UUID4.

Here's the code:

        for index, row in enumerate(json_rows):
            info = {"json": row}
            if row_ids is not None:
                info["insertId"] = row_ids[index]
            else:
                info["insertId"] = str(uuid.uuid4())
            rows_info.append(info)

However, insert IDs are entirely optional, and there are actually valid use cases not to use them. From the BigQuery documentation:

You can disable best effort de-duplication by not populating the insertId field for each row inserted. When you do not populate insertId, you get higher streaming ingest quotas in certain regions. This is the recommended way to get higher streaming ingest quota limits.

The BigQuery Python client library provides no way of omitting the insertIds. it would be nice to have a parameter for that.

Reacted by Mattia Gentil

Activity

  1. product-auto-label
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    on Jun 25, 2021
  2. yoshi-automation
    added
    triage meI really want to be triaged.
    on Jun 26, 2021
  3. plamut
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    triage meI really want to be triaged.
    on Jun 28, 2021
  4. plamut commented on Jun 28, 2021

    @plamut
    plamut
    on Jun 28, 2021
    Contributor
    More actions

    I'll double check why this is the case, but at a glance this request sounds reasonable. 👍

  5. tswast commented on Jun 28, 2021

    @tswast
    tswast
    on Jun 28, 2021
    Contributor
    More actions

    I recall that you can explicitly pass in a list of None values to omit these.

    It might be useful to have a more discoverable way to do this, though.

  6. pietrodn commented on Jun 29, 2021

    @pietrodn
    pietrodn
    on Jun 29, 2021
    Author
    More actions

    I recall that you can explicitly pass in a list of None values to omit these.

    It might be useful to have a more discoverable way to do this, though.

    It seems to work. However I don't see the point in allocating memory just to generate a list of Nones, maybe it can be improved? :-)

  7. plamut commented on Jun 29, 2021

    @plamut
    plamut
    on Jun 29, 2021
    Contributor
    More actions

    A memory efficient alternative would be to provide a fake sequence-ish object that returns None for every index:

    class NoneItems:
        def __getitem__(self, index):
            return None
    
    >>> insert_ids = NoneItems()
    >>> assert insert_ids[0] is None
    >>> assert insert_ids[1] is None
    >>> assert insert_ids[42] is None

    A bit hacky, but should be a good enough workaround until more user friendly support is added. :)

  8. plamut commented on Jun 29, 2021

    @plamut
    plamut
    on Jun 29, 2021
    Contributor
    More actions

    Update: This was confirmed, we'll add support for this in a more user-friendly way.

    Reacted by Tim Sweña (Swast)
    Reacted by Pietro De Nicolao
  9. plamut
    self-assigned this
    on Jun 29, 2021
  10. plamut
    closed this as completedin #734on Jul 1, 2021
  11. pietrodn commented on Jul 1, 2021

    @pietrodn
    pietrodn
    on Jul 1, 2021
    Author
    More actions

    Amazing, thanks!

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

Metadata

Metadata

Assignees

  • @plamut
    plamut

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

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.