Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
api_unit_test_log
=================================== FAILURES ===================================
__________________________ test_remove_expired_column __________________________
[gw2] linux -- Python 3.6.8 /sd_api/venv/bin/python
async def test_remove_expired_column():
db = util.get_mysql_session()
column_sqlalchemy = None
try:
creation_date = datetime.datetime.now() - datetime.timedelta(days=9)
database = get_test_purpose_database(db, is_test=True)
column_sqlalchemy = models.DatabaseColumn(
database_id=database.id,
name="test_column",
api_name="test_column",
type="integer",
shannondb_type="numeric",
dimension="test-table-0",
constraint_api_name="expired_column_test",
created_at=creation_date
)
db.add(column_sqlalchemy)
> db.commit()
tests/unit/crud/column/test_column.py:418:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py:1026: in commit
self.transaction.commit()
../venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py:493: in commit
self._prepare_impl()
../venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py:472: in _prepare_impl
self.session.flush()
../venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py:2451: in flush
self._flush(objects)
../venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py:2589: in _flush
transaction.rollback(_capture_exception=True)
../venv/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py:68: in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:129: in reraise
raise value
../venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py:2549: in _flush
flush_context.execute()
../venv/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py:422: in execute
rec.execute(self)
../venv/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py:589: in execute
uow,
../venv/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py:245: in save_obj
insert,
../venv/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py:1120: in _emit_insert_statements
statement, params
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:988: in execute
return meth(self, multiparams, params)
../venv/lib/python3.6/site-packages/sqlalchemy/sql/elements.py:287: in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1107: in _execute_clauseelement
distilled_params,
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1248: in _execute_context
e, statement, parameters, cursor, context
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1466: in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:383: in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
../venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py:128: in reraise
raise value.with_traceback(tb)
../venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py:1244: in _execute_context
cursor, statement, parameters, context
../venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py:552: in do_execute
cursor.execute(statement, parameters)
../venv/lib/python3.6/site-packages/MySQLdb/cursors.py:250: in execute
self.errorhandler(self, exc, value)
../venv/lib/python3.6/site-packages/MySQLdb/connections.py:50: in defaulterrorhandler
raise errorvalue
../venv/lib/python3.6/site-packages/MySQLdb/cursors.py:247: in execute
res = self._query(query)
../venv/lib/python3.6/site-packages/MySQLdb/cursors.py:411: in _query
rowcount = self._do_query(q)
../venv/lib/python3.6/site-packages/MySQLdb/cursors.py:374: in _do_query
db.query(q)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_mysql.connection open to 'mysql' at 2298c58>
query = b"INSERT INTO data_database_column (name, api_name, description, active, time_series_ttl, type, deleted, shannondb_typ...LL, NULL, '2019-08-21 17:43:10.646684', NULL, NULL, 'test-table-0', NULL, NULL, 34394, 'expired_column_test', NULL, 0)"
def query(self, query):
# Since _mysql releases GIL while querying, we need immutable buffer.
if isinstance(query, bytearray):
query = bytes(query)
if self.waiter is not None:
self.send_query(query)
self.waiter(self.fileno())
self.read_query_result()
else:
> _mysql.connection.query(self, query)
E sqlalchemy.exc.IntegrityError: (_mysql_exceptions.IntegrityError) (1062, "Duplicate entry 'expired_column_test' for key 'ProjectField_constraint_api_name_b3fd214f_uniq'")
E [SQL: INSERT INTO data_database_column (name, api_name, description, active, time_series_ttl, type, deleted, shannondb_type, values_range, storage, decimal_places, created_at, updated_at, deleted_at, dimension, referenced_dimension, relation_name, database_id, constraint_api_name, category_id, new_format) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)]
E [parameters: ('test_column', 'test_column', None, 1, -1, 'integer', 0, 'numeric', None, None, None, datetime.datetime(2019, 8, 21, 17, 43, 10, 646684), None, None, 'test-table-0', None, None, 34394, 'expired_column_test', None, 0)]
E (Background on this error at: http://sqlalche.me/e/gkpj)
../venv/lib/python3.6/site-packages/MySQLdb/connections.py:277: IntegrityError
================ 1 failed, 22 passed, 1 skipped in 4.15 seconds ================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment