Skip to content
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.

Magic params flag fails with negative numbers #108

Description

@teebr

Environment details

Colab (Ubuntu 18.04 LTS, Python 3.6.9, pip 19.3.1, bigquery 1.21.0)

Issue/ Example

For a parameterised query, the magic fails to parse negative numbers.

For example, this parameter dict:

params = {
    "threshold": -5.0,
    "min_year": 2000
}

and this query:

%%bigquery  --project my-project-name --params $params
SELECT
    year, MIN(mean_temp) as min, COUNTIF(snow) / COUNT(snow) * 100 AS pc_snowing
FROM
     `bigquery-public-data.samples.gsod`
WHERE mean_temp < @threshold
AND year >= @min_year
GROUP BY year
ORDER BY year

runs fine if threshold is >= 0, but if it's negative, the Magic gets an exception:

UsageError: unrecognized arguments: -5.0, 'min_year': 2000}

This happens whether it's a dictionary or a JSON string, and happens with ints as well as floats.

Activity

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

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions