Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2023 08:48 AM
For a single-value tuple, you need to use a check to modify the SQL query as well as how the tuple is passed. The single-value tuples will always have a comma at the end. You need to modify the query to be able to pass only the value from the tuple. The new query would look something like
query = ("""
select key,
case
when column in {tuple1} then 1
when column in ({tuple2}) then 2
end as check
from table
""".format(tuple1 = tuple1, tuple2 = tuple2[0], combo = combo))