I am creating a pool connection like this
psql<-dbPool(
RPostgreSQL::PostgreSQL(),
dbname = dw$database,
port = dw$port,
user = dw$uid,
password = dw$pwd
)
and I want to run some parameterized queries on it. the most basics are like
query<-dbSendQuery(psql,"select * from ? limit 100")
dbBind(query,list('production'))
dbFetch(query)
But when I try to do that I get the error
> query<-dbSendQuery(psql,"select * from ? limit 100")
Error in dbSendQuery(psql, "select * from ? limit 100") :
Must use `conn <- poolCheckout(pool); dbSendQuery(conn, statement, ...)` instead. Remember to `poolReturn(conn)` when `conn` is no longer necessary.
> dbBind(query,list('production'))
Error in dbBind(query, list("production")) : object 'query' not found
> dbFetch(query)
Error in dbFetch(query) : object 'query' not found
when I run the command as asked in error. It doesn't help or produce an error
> con<-poolCheckout(psql)
> con
<PostgreSQLConnection>
But my connection is valid and I can run queries like
can somebody please help me out how to do this as I have to use it in a shiny app Urgently. Please help me out if you have any solution or should I just go back to normal dbconnect or DBI functions instead of pool.