Is there a way to print this statement in a shiny app, but not evaluate it?
I get this error
Warning: Error in eval: object 'table_name' not found
I get the same error when all the lines inside glue are hashed out.
library(shiny)
library(glue)
ui <- pageWithSidebar(
headerPanel("test"),
sidebarPanel(),
mainPanel(
verbatimTextOutput("info_in_db")
)
)
server <- function(input, output) {
output$info_in_db <- renderPrint(
glue("
# add table description in to the PostgreSQL - backticks where sql quoting is used
DBI::dbSendQuery(CON, glue_sql(\"COMMENT ON TABLE {`table_name`} IS {table_info}\", .con = CON))
# add columns description in to the PostgreSQL - backticks where SQL quoting is used
purrr::walk2(column_info$column,
column_info$description,
~ dbSendQuery(CON, glue_sql(\"COMMENT ON COLUMN {`table_name`}.{`.x`} IS {.y}\",
.con = CON)))
")
)
}
shinyApp(ui, server)