SQL param

This guide assumes familiarity with:

sql.param lets you define a parameter with a custom type accepted by the ClickHouse client

By default, passing 10 will generate this SQL and parameters array

await sql`select * from ${sql.identifier("users")} where ${sql.identifier("id")} = ${10}`
select * from `users` where id = {param1:String};
-- params: { param1: 10 }

You can use sql.param to override this behavior

await sql`select * from ${sql.identifier("users")} 
          where ${sql.identifier("id")} = ${sql.param(10, 'Int32')}`
select * from `users` where id = {param1:Int32};
-- params: { param1: 10 }