trinodb / trino-go-client

Go client for Trino
Apache License 2.0
135 stars 63 forks source link

Does trino-go-client support golang sql.NamedArg? #101

Closed zclyne closed 10 months ago

zclyne commented 10 months ago

Hi, I am using this trino client to query our trino database and I cannot figure out how to use golang sql.NamedArg with it. For example, the query function call looks like:

db.Query("SELECT * FROM prometheus WHERE \"metricName\" = :metric", sql.NamedArg("metric", "cpu_usage"))

But I received the following error:

 Error executing query: trino: query failed (400 Bad Request): "Invalid X-Trino-Prepared-Statement header: line 1:73: mismatched input ':'. Expecting: 'ALL', 'ANY', 'SOME', <expression>"

I have also tried @metric but it didn't work either, so I am wondering whether the trino client supports NamedArg or not?

My runtime environment is:

Thank you!

nineinchnick commented 10 months ago

Trino doesn't support named parameters, only positional ones.

zclyne commented 10 months ago

Thank you!