It seems when I pass a comment to dbGetQuery()
it doesn't send the comment to our database. Is there a way to preserve comments?
I'm trying track which apps on Posit Connect are sending which queries and trying to do something like this:
library(odbc)
library(glue)
glue_guid <- function(x) {
glue(
"/*platform: rsc, id: {guid}*/ {x}",
guid = Sys.getenv('CONNECT_CONTENT_GUID') # exists on RStudio/Posit Connect
)
}
conn <- dbConnect(...)
sql <- glue_guid("select * from my_table")
# /*platform: rsc, id: */ select * from my_table
dbGetQuery(conn, sql)
So the questions are:
- Is there some better way to track SQL queries to apps from connect to our database?
- If not, is this approach ^^^ even possible?
- If not, could/should I make an issue and if so, which package?
DBI
orodbc
? I thinkDBI
is doing it here