Skip to content

Commit ba0dd02

Browse files
committed
Addressing @obi1kenobi's comments
1 parent 3c3d9e2 commit ba0dd02

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

graphql_compiler/compiler/emit_sql.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ def _transform_binary_composition_to_expression(expression, node, context):
219219
right.expanding = True
220220
clause = getattr(left, sql_operator.name)(right)
221221
return clause
222-
else:
223-
raise AssertionError(u'Unknown operator cardinality {}'.format(sql_operator.cardinality))
222+
raise AssertionError(u'Unreachable, operator cardinality {} for compiler expression {} is '
223+
u'unknown'.format(sql_operator.cardinality, expression))
224224

225225

226226
def _get_column_and_bindparam(left, right, operator):
@@ -230,11 +230,11 @@ def _get_column_and_bindparam(left, right, operator):
230230
if not isinstance(left, Column):
231231
raise AssertionError(
232232
u'SQLAlchemy operator {} expects Column as left side the of expression, got {} '
233-
u'of type {}'.format(operator, left, type(left)))
233+
u'of type {} instead.'.format(operator, left, type(left)))
234234
if not isinstance(right, BindParameter):
235235
raise AssertionError(
236-
u'SQLAlchemy operator {} expects BindParameter as the right side of the expression, got'
237-
u' {} of type {}'.format(operator, right, type(right)))
236+
u'SQLAlchemy operator {} expects BindParameter as the right side of the expression, '
237+
u'got {} of type {} instead.'.format(operator, right, type(right)))
238238
return left, right
239239

240240

graphql_compiler/compiler/ir_lowering_sql/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ def visitor_fn(expression):
240240
if not isinstance(expression, expressions.UnaryTransformation):
241241
return expression
242242
raise NotImplementedError(
243-
u'UnaryTransformation expression "{}" is unsupported by SQL backend.'.format(expression)
243+
u'UnaryTransformation expression "{}" encountered with IR blocks {} is unsupported by '
244+
u'the SQL backend.'.format(expression, ir_blocks)
244245
)
245246

246247
new_ir_blocks = [

graphql_compiler/tests/integration_tests/integration_test_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ def try_convert_decimal_to_string(value):
3131
"""Return Decimals as string if value is a Decimal, return value otherwise."""
3232
if isinstance(value, list):
3333
return [try_convert_decimal_to_string(subvalue) for subvalue in value]
34-
if not isinstance(value, Decimal):
35-
return value
36-
return str(value)
34+
if isinstance(value, Decimal):
35+
return str(value)
36+
return value
3737

3838

3939
def compile_and_run_match_query(schema, graphql_query, parameters, graph_client):
4040
"""Compiles and runs a MATCH query against the supplied graph client."""
41-
# OrientDB expects decimals to be passed as their string representation
41+
# MATCH code emitted by the compiler expects Decimals to be passed in as strings
4242
converted_parameters = {
4343
name: try_convert_decimal_to_string(value)
4444
for name, value in six.iteritems(parameters)

0 commit comments

Comments
 (0)