Scala has a library called Slick which takes a similar approach: https://scala-slick.org
The DSL is nice for simple querying and for composing queries based upon user input. But, for anything slightly complex, I found it's better to just use regular SQL.