https://kotlinlang.org logo
#exposed
Title
# exposed
b

Berkay Özkan

11/08/2023, 10:25 PM
Hi, is there a way to create sql without db conection or wrapping in transaction. I just want to create string sql query using exposed DSL
2
s

spand

11/09/2023, 7:37 AM
Sql is inherently dialect specific but for basic cases maybe this works:
Copy code
query.prepareSQL(QueryBuilder(false))
b

Berkay Özkan

11/09/2023, 7:40 AM
This requires Db connection and transaction
s

spand

11/09/2023, 7:42 AM
The easiest workaround is probably to connect to an inmemory h2 database then
b

Berkay Özkan

11/09/2023, 7:43 AM
yeah but it felt too hacky 😄
a

Aleksei Tirman [JB]

11/15/2023, 4:35 PM
This requires a connection because a metadata required to build a query can only be retrieved from the server.