Test output
self =
sql = "INSERT INTO Singers (SingerId, FirstName, LastName) VALUES\n (12, 'Melissa', 'Garcia'),\n (13, 'Russell', 'Morales'),\n (14, 'Jacqueline', 'Long'),\n (15, 'Dylan', 'Shaw')"
args = None
def execute(self, sql, args=None):
"""Prepares and executes a Spanner database operation.
:type sql: str
:param sql: A SQL query statement.
:type args: list
:param args: Additional parameters to supplement the SQL query.
"""
if not self.connection:
raise ProgrammingError("Cursor is not connected to the database")
self._raise_if_closed()
self._result_set = None
# Classify whether this is a read-only SQL statement.
try:
classification = parse_utils.classify_stmt(sql)
if classification == parse_utils.STMT_DDL:
self.connection._ddl_statements.append(sql)
return
# For every other operation, we've got to ensure that
# any prior DDL statements were run.
# self._run_prior_DDL_statements()
self.connection.run_prior_DDL_statements()
../../google/cloud/spanner_dbapi/cursor.py:190:
self = <google.cloud.spanner_dbapi.connection.Connection object at 0x7f5b2b1b6750>
def run_prior_DDL_statements(self):
self._raise_if_closed()
if self._ddl_statements:
ddl_statements = self._ddl_statements
self._ddl_statements = []
return self.database.update_ddl(ddl_statements).result()
../../google/cloud/spanner_dbapi/connection.py:281:
self = <google.api_core.operation.Operation object at 0x7f5b2b0fef10>
timeout = None, retry = <google.api_core.retry.Retry object at 0x7f5b2b4a6c50>
def result(self, timeout=None, retry=DEFAULT_RETRY):
"""Get the result of the operation, blocking if necessary.
Args:
timeout (int):
How long (in seconds) to wait for the operation to complete.
If None, wait indefinitely.
Returns:
google.protobuf.Message: The Operation's result.
Raises:
google.api_core.GoogleAPICallError: If the operation errors or if
the timeout is reached before the operation completes.
"""
kwargs = {} if retry is DEFAULT_RETRY else {"retry": retry}
self._blocking_poll(timeout=timeout, **kwargs)
if self._exception is not None:
# pylint: disable=raising-bad-type
# Pylint doesn't recognize that this is valid in this case.
E google.api_core.exceptions.FailedPrecondition: 400 Duplicate name in schema: Singers.
.nox/py-3-7/lib/python3.7/site-packages/google/api_core/future/polling.py:134: FailedPrecondition
During handling of the above exception, another exception occurred:
capsys = <_pytest.capture.CaptureFixture object at 0x7f5b2b0751d0>
database = <google.cloud.spanner_v1.database.Database object at 0x7f5b2b024d90>
@RetryErrors(exception=Aborted, max_tries=2)
def test_enable_autocommit_mode(capsys, database):
connection = connect(INSTANCE_ID, DATABASE_ID)
cursor = connection.cursor()
with mock.patch(
"google.cloud.spanner_dbapi.connection.Cursor", return_value=cursor,
):
autocommit.enable_autocommit_mode(INSTANCE_ID, DATABASE_ID)
autocommit_test.py:62:
autocommit.py:36: in enable_autocommit_mode
(15, 'Dylan', 'Shaw')"""
self = <google.cloud.spanner_dbapi.cursor.Cursor object at 0x7f5b2b11bb50>
sql = "INSERT INTO Singers (SingerId, FirstName, LastName) VALUES\n (12, 'Melissa', 'Garcia'),\n (13, 'Russell', 'Morales'),\n (14, 'Jacqueline', 'Long'),\n (15, 'Dylan', 'Shaw')"
args = None
def execute(self, sql, args=None):
"""Prepares and executes a Spanner database operation.
:type sql: str
:param sql: A SQL query statement.
:type args: list
:param args: Additional parameters to supplement the SQL query.
"""
if not self.connection:
raise ProgrammingError("Cursor is not connected to the database")
self._raise_if_closed()
self._result_set = None
# Classify whether this is a read-only SQL statement.
try:
classification = parse_utils.classify_stmt(sql)
if classification == parse_utils.STMT_DDL:
self.connection._ddl_statements.append(sql)
return
# For every other operation, we've got to ensure that
# any prior DDL statements were run.
# self._run_prior_DDL_statements()
self.connection.run_prior_DDL_statements()
if not self.connection.autocommit:
if classification == parse_utils.STMT_UPDATING:
sql = parse_utils.ensure_where_clause(sql)
if classification != parse_utils.STMT_INSERT:
sql, args = sql_pyformat_args_to_spanner(sql, args or None)
statement = Statement(
sql,
args,
get_param_types(args or None)
if classification != parse_utils.STMT_INSERT
else {},
ResultsChecksum(),
classification == parse_utils.STMT_INSERT,
)
(self._result_set, self._checksum,) = self.connection.run_statement(
statement
)
self._itr = PeekIterator(self._result_set)
return
if classification == parse_utils.STMT_NON_UPDATING:
self._handle_DQL(sql, args or None)
elif classification == parse_utils.STMT_INSERT:
_helpers.handle_insert(self.connection, sql, args or None)
else:
self.connection.database.run_in_transaction(
self._do_execute_update, sql, args or None
)
except (AlreadyExists, FailedPrecondition) as e:
raise IntegrityError(e.details if hasattr(e, "details") else e)
E google.cloud.spanner_dbapi.exceptions.IntegrityError: 400 Duplicate name in schema: Singers.
../../google/cloud/spanner_dbapi/cursor.py:223: IntegrityError
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: 01d3b06
buildURL: Build Status, Sponge
status: failed
Test output