OHDSI/DatabaseConnector

multiple extraSettings for postgres

Open

#273 opened on Jun 5, 2024

 (0 comments) (0 reactions) (0 assignees)R (91 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (57 stars)
PR merge metrics
 (PR metrics pending)

Description

Your R help file does not specify how to handle multiple extraSettings for postgres: https://github.com/OHDSI/DatabaseConnector/blob/bee58a314996123b59e08bd489bf712e14391c4f/man/connect.Rd#L109-L117

nor does the related vignette or pdf document

looking at https://github.com/OHDSI/DatabaseConnector/blob/bee58a314996123b59e08bd489bf712e14391c4f/R/Connect.R#L479

it appears that the connectPostgreSql function expects a single string for extraSettings, but the option separator is not specified. I had initially attempted ; ala MS SQL, but I should have been using & for postgres (similar to redshift).

My request is, at the very least, please include a multi-parameter string for extraSettings for postgres in the help file. Ideally you could accept a character vector of length >1, rather than just a simple "string" and parse for the individual depending on the DBMS that they are using.

An example of this would be to modify https://github.com/OHDSI/DatabaseConnector/blob/bee58a314996123b59e08bd489bf712e14391c4f/R/Connect.R#L479 to read

connectionString <- paste(connectionString, connectionDetails$extraSettings, sep = "?", collapse="&")

this will have no impact if length(connectionDetails$extraSettings) == 1, but if length(...)>1 (and class(connectionDetails$extraSettings) == 'character' still) it will collapse it appropriately

you could then make similar changes for the other database types.

my current work-around is, when calling createConnectionDetails, to specify that extraSettings = paste(c("sslmode=require","ssl=true","currentSchema=myschema"),collapse="&"), but such a solution requires the end-user to know the correct separator for their RDMS connection string and is honestly no better than just setting the string to "sslmode=require&ssl=true&currentSchema=myschema" directly

Contributor guide