Comment by caturopath

Comment by caturopath 2 days ago

1 reply

For any of you also confused by

    with sql_context(columns="x"):
        query, values = sql(t"SELECT {col} FROM y")
I think

1. this is relying on the `col = "x"` in the previous example

2. columns is a set of strings, so it might be sql_context(columns={"foo", "bar", "x"}) to allow those as valid options. It just happens that "x" is a collection supporting the `in` operator so it works much like the set {"x"} would.

2a. (You might hope that something would convert such a string to a singleton set, but I don't think it does, which would have weird results with a multi-letter string.)

pgjones 2 days ago

Sorry that is a typo, I meant,

    with sql_context(columns={"x"}):