def test_query_with_parameters(self, project_id):
sql_statement = "SELECT @param1 + @param2 AS valid_result"
config = {
"query": {
"useLegacySql": False,
"parameterMode": "named",
"queryParameters": [
{
"name": "param1",
"parameterType": {"type": "INTEGER"},
"parameterValue": {"value": 1},
},
{
"name": "param2",
"parameterType": {"type": "INTEGER"},
"parameterValue": {"value": 2},
},
],
}
}
# Test that a query that relies on parameters fails
# when parameters are not supplied via configuration
with pytest.raises(ValueError):
gbq.read_gbq(
sql_statement,
project_id=project_id,
credentials=self.credentials,
dialect="legacy",
)
# Test that the query is successful because we have supplied
# the correct query parameters via the 'config' option
df = gbq.read_gbq(
sql_statement,
project_id=project_id,
credentials=self.credentials,
configuration=config,
dialect="legacy",
)
E AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="valid_result") are different
E
E Attribute "dtype" are different
E [left]: Int64
E [right]: int64
This test failed!
To configure my behavior, see the Flaky Bot documentation.
If I'm commenting on this issue too often, add the
flakybot: quietlabel andI will stop commenting.
commit: 928e47b
buildURL: Build Status, Sponge
status: failed
Test output