glue - printing but not evaluating a statement in shiny - renderPrint

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)

Not glue or renderPrint, but it is possible to just include it as a text file or using RMarkdown:

https://shiny.rstudio.com/gallery/including-html-text-and-markdown-files.html

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.