is it possible to parameterize the table names in hugsql?
i believe it is. look at identities
can you point to the docs somwehre? i dont' see anything about identities
sorry i meant identifiers: https://www.hugsql.org/#param-identifier
ah neat! thanks dunno how i missed that 😊
np. i had the same question. I think if you want to do lot of composing then you might want honey sql. my gut tells me there is nothing wrong with mixing the two libs/approaches
their pros and cons complement each other
hug is straight forward and the most direct path. Honey itches the scratch of being able to build sql queries programmatically.
datomic solves both issues in so far as i can tell.
i completely agree with you, hugsql makes me end up writing my won dsl -- in the cases where i want to make advantage of postgres's functoinaitly it's easier to use hugsql for that case
i'd love to use datomic 😊 haha, one day
seems not, it's not part of JDBC's prepared statement, so I shouldnt -- in the meantime, I've been able to do this to get sqlvec's handily:
(defn delete-query [table column values]
(let [f (hugsql.core/sqlvec-fn (format "delete * from %s where %s IN (:v:values)" table column)]
(f {:value values}))))
(delete-query "foo" "id" [1 2 3 4])
;; ["delete * from foo where id IN ( ? )" [1 2 3 4]]
This is of course a bit off topic but does nyone know of libraries like HugSQL but for Python?
@rovanion never tried it myself