FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(dbapi): avoid running % format with no query parameters by HemangChothani · Pull Request #348 · googleapis/python-bigquery · GitHub

This repository was archived by the owner on Mar 6, 2026. It is now read-only.
/ python-bigquery Public archive

fix(dbapi): avoid running % format with no query parameters - #348

Merged
tswast merged 4 commits into
googleapis:masterfrom
MaxxleLLC:bigquery_issue_346
Oct 29, 2020
Merged

tswast merged 4 commits into
googleapis:masterfrom
MaxxleLLC:bigquery_issue_346

Conversation

Copy link
Copy Markdown
Contributor

Fixes #346

HemangChothani requested review from a team and tswast October 28, 2020 08:43
google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 28, 2020
Comment thread tests/unit/test_dbapi_cursor.py Outdated
def test__format_operation_w_empty_dict(self):
from google.cloud.bigquery.dbapi import cursor

formatted_operation = cursor._format_operation("SELECT 1", {},)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Won't the linter complain about the trailing comma here?

Comment thread tests/unit/test_dbapi_cursor.py Outdated
from google.cloud.bigquery.dbapi import cursor

formatted_operation = cursor._format_operation("SELECT 1", {})
self.assertEqual(formatted_operation, "SELECT 1")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Actually, let's put a % sign in this string to catch the reported error

Suggested change
self.assertEqual(formatted_operation, "SELECT 1")
self.assertEqual(formatted_operation, "SELECT '%f'")

tswast changed the title fix: aviod running %format when no query params fix(dbapi): avoid running % format with no query parameters Oct 29, 2020
tswast merged commit 5dd1a5e into googleapis:master Oct 29, 2020

tswast commented Oct 29, 2020

Copy link
Copy Markdown
Contributor

Thanks for the quick fix!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(dbapi): avoid running % format when no query parameters are passed

2 participants


Back | FazBrowse Home | New Git URL