Let's say I have a 'line_item' object with values x, y, and z. If I used the following code:
columns_to_write = [
"x",
"y",
"z",
]
params = (line_item.get(col) for col in columns_to_write)
And let's say there's a specific issue which sometimes occurs in 'z', where I want to cast it to a string if it's not a string. What would be the syntax for that be? I'm imagining something like...
params = (if col == "z" then str(line_item.get(col)) else line_item.get(col) for col in columns_to_write)