Skip to content

Conversation

HemangChothani
Copy link
Contributor

Fixes #346

@HemangChothani HemangChothani requested review from a team and tswast October 28, 2020 08:43
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 28, 2020
def test__format_operation_w_empty_dict(self):
from google.cloud.bigquery.dbapi import cursor

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

Choose a reason for hiding this comment

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

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

from google.cloud.bigquery.dbapi import cursor

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

Choose a reason for hiding this comment

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

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 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 tswast merged commit 5dd1a5e into googleapis:master Oct 29, 2020
@tswast
Copy link
Contributor

tswast commented Oct 29, 2020

Thanks for the quick fix!

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

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