I do not think it is possible from a technical perspective to dynamically create the columns based on the data returned by the query. It's just not supported by sqlite (and probably SQL standard?). It should be possible to use recursive queries to generate something with a schema like
(key, value)
.