Is there a way to use an identifier to pass a schema with a constant table name?
That's exactly what I was asking about two posts earlier. I have long tables named like this:
{{ realm }}_foo_bar_baz
where realm might be prod , test , training and so on. And I'ld like to pass only the realm part. But it looks like it's not possible in Hug
that's really unfortunate
Alas, indeed. Sharing this for the context:
Apparently, I ended up with a primitive templating system:
(defn render [template context]
(reduce-kv
(fn [result field value]
(let [pattern
(re-pattern
(str "\\{\\{\\s*" (name field) "\\s*\\}\\}"))]
(str/replace result pattern (str value))))
template
context))
(render "I've got {{ amount }} apples" {:amount 3})
I've got 3 apples
and I use it to render vast SQL filesUsually my SQL files have everything hardcoded except schemas, because they rely on the current environment.
yeah, this is the exact case that I wanted to cover
That's of course dangerous in terms of injections
I mean identifiers in hug already are
just can't have untrusted input going in there
They get qouted with or '' depending on the backend option
yeah, it's the same after all
But if you find a way to do it in Hug, could you please let me know?
Absolutely will!
I tried in mysql, but this appears to break because of the quoting
select * from `:i:schema`.tableName