jet
jet copied to clipboard
Print Full SQL Instead of PreparedStatement
Is your feature request related to a problem? Please describe.
Currently we are using RDS Data API which has a very specific way of doing queries (Doesn't support ?
character).
We required to either have named placeholders (each prefixed by :
) and typed arguments, or we just call ExecuteStatement
with the fully generated and escaped SQL.
Connecting directly via Connection String is not an option because we are using AWS Lambda.
Describe the solution you'd like
A .RawSql()
Function that prints the whole SQL
Hi @driverpt. .DebugSql()
will return SQL without parameters.
Will it he pretty printed? I'm asking because some of the queries are a bit big and there is a 1 MB Limit
DebugSql
will return valid sql. You can see sample here or in tests.
But, note that DebugSql
is not intended to be used on the production, because of the possible SQL injection attacks.
If I were you, I would probably use .Sql()
and replace each occurrence of ?
with some generated name :gen_name
in the query.
We could do what, but wouldn't it be a bit costly in long queries?
AWS RDS Data Api is nice, but it requires a lot of custom code.
Is there some way of creating a custom adapter for JET? To generate the query to Execute Statement Endpoint?
How big are the queries? 1MB?
You can also fork the repo and update ArgumentPlaceholder function -
return ":var_" + strconv.Itoa(ord)
.
Or maybe update the code so that this function can be updated on startup.
Is there some way of creating a custom adapter for JET? To generate the query to Execute Statement Endpoint?
Not sure what you mean?
Do you mean adapter for query generation (.Sql()
)? Should be answered with above comment.
Or do you mean do adapt .Exec
or .Query
methods? No, there is no such possibility.
Can you make these configurable when we're initializing Jet?
Can you modify the ArgumentPlaceholder
Function to also receive the Parameter Name ?
Thanks in advance
I think it is the best, for you to fork the project and make necessary changes. Additional changes will probably be needed, because this data source is not supported currently.