diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index ab4b9a402..415463e02 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -140,7 +140,7 @@ def constraints_to_sql(constraints, joiner=' AND ', prepend_key=''): if constraint: if isinstance(constraint, (list, set, tuple)): if len(constraint) == 1: - values[f'{key}{tag}'] = constraint[0] + values[f'{key}{tag}'] = next(iter(constraint)) sql.append(f'{col} {one_val_op} :{key}{tag}') else: keys = [] diff --git a/tests/unit/wallet/test_database.py b/tests/unit/wallet/test_database.py index 6b05d239e..29ef58b46 100644 --- a/tests/unit/wallet/test_database.py +++ b/tests/unit/wallet/test_database.py @@ -99,7 +99,7 @@ class TestQueryBuilder(unittest.TestCase): }) ) self.assertTupleEqual( - constraints_to_sql({'txo.name__in': ('abc123',)}), + constraints_to_sql({'txo.name__in': {'abc123'}}), ('txo.name = :txo_name__in0', { 'txo_name__in0': 'abc123', })