fix(query_combiner): add try block to handle queries of type str (#4397)

Co-authored-by: Harshal Sheth <hsheth2@gmail.com>
This commit is contained in:
WaStCo 2022-03-15 01:45:28 +01:00 committed by GitHub
parent a12c9d2a30
commit bd3090ae86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,7 +213,13 @@ class SQLAlchemyQueryCombiner:
# Figure out how many columns this query returns.
# This also implicitly ensures that the typing is generally correct.
assert len(get_query_columns(query)) > 0
try:
assert len(get_query_columns(query)) > 0
except AttributeError as e:
logger.debug(
f"Query of type: '{type(query)}' does not contain attributes required by 'get_query_columns()'. AttributeError: {e}"
)
return False, None
# Add query to the queue.
queue = self._get_queue(main_greenlet)