openjusticeok / ojodb

OJO's R package for opening the black box of our justice system
https://openjusticeok.github.io/ojodb/
GNU General Public License v3.0
8 stars 3 forks source link

`ojo_list_vars` broken #75

Closed brancengregory closed 1 year ago

andrewjbe commented 1 year ago

It looks like the issue was that pool::dbListFields() wasn't handling the multiple schemas well. I just replaced it with a call of pool::dbGetQuery() instead that returns the result of the following SQL statement:

  query <- dbplyr::sql(stringr::str_c("SELECT column_name FROM information_schema.columns WHERE table_schema = '",
                                      schema,
                                      "' AND table_name = '",
                                      table, "'"))

Written more simply, that's just:

SELECT column_name FROM information_schema.columns WHERE table_schema = [schema the user wants to know about] AND table_name = [table the user wants to know about]