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 — allow the body of `%%bigquery` cell magic to be a `$variable` · Issue #1040 · 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.

allow the body of %%bigquery cell magic to be a $variable #1040

Copy link
Copy link
Closed
#1053
Closed
allow the body of %%bigquery cell magic to be a $variable#1040
#1053
Copy link
Assignees
loferris
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

@tswast
tswast
opened on Nov 1, 2021
Issue body actions

Is your feature request related to a problem? Please describe.

When using BigQuery notebooks. There are queries that would be nice to be parametrized, but the parameters are in places where BigQuery parameterized queries don't work. For example, you can't parametrize the table ID.

Describe the solution you'd like

When a $variable is the only thing in the query body, replace it with the value from the variable in Python. This is similar to how the first %%bigquery line works.

Cell 1

yourprojectid = "swast-scratch"
query = "SELECT * FROM something"

Cell 2

%%bigquery --project $yourprojectid
$query

Describe alternatives you've considered

One could try and find any $variable in the query body, but this would be a breaking change.

Additional context

Currently the %%bigquery has some logic to see if the body is a table ID or a full query. We should retain this logic, and it should happen after the replacement of the variable. Detecting if the body is only a $variable should be similar to the detection of if the body is only a table ID.

Feature request is from an email thread "python magics - fully parameterized query" with @minhaz and @shollyman

Activity

  1. tswast
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Nov 1, 2021
  2. tswast
    assigned
    loferris
    on Nov 1, 2021
  3. plamut commented on Nov 7, 2021

    @plamut
    plamut
    on Nov 7, 2021
    Contributor
    More actions

    I have some free cycles next week, is this already in progress or just assigned for now?
    Thanks! 🙂

    Update: Discussed offline, I can handle this and then move on to some v3 issues, and can assign Lo as a reviewer for onboarding purposes.

    Reacted by Minhaz Kazi
  4. plamut
    closed this as completedin #1053on Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @loferris
    loferris

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.