OHDSI / DatabaseConnector

An R package for connecting to databases using JDBC.
http://ohdsi.github.io/DatabaseConnector/
54 stars 80 forks source link

Issue with DBMS/jdbcDriver #190

Closed kandeyGiridhar closed 1 year ago

kandeyGiridhar commented 2 years ago

I am trying to run an R study package generated in the population level estimation. When running the execute function.

ERROR IN CONSOLE

Error in execute(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, : 1 assertions failed:

Variable ‘dbms’: Must be element of set {‘sql server’, ‘oracle’, ‘postgresql’, ‘pdw’, ‘impala’, ‘netezza’, ‘bigquery’, ‘spark’, ‘sqlite’, ‘redshift’, ‘hive’, ‘sqlite extended’}, but types do not match (character != factor). CODE EXECUTED

Set and view environment variable

Sys.setenv(“DATABASECONNECTOR_JAR_FOLDER” = “/home/ohdsi/JDBC/”) Sys.getenv(“DATABASECONNECTOR_JAR_FOLDER”) downloadJdbcDrivers(“postgresql”)

Database connection string connectionDetails ← createConnectionDetails( dbms = “postgresql”, server=“localhost/omop”, user="", password="**", port=“5432”, pathToDriver ="/home/ohdsi/JDBC/" )

oracleTempSchema = NULL options(andromedaTempFolder= “/home/ohdsi/temp/”)

execute(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, cohortDatabaseSchema = cohortDatabaseSchema, cohortTable = cohortTable, oracleTempSchema = oracleTempSchema, outputFolder = outputFolder, databaseId = databaseId, databaseName = databaseName, createCohorts = TRUE, synthesizePositiveControls = FALSE, runAnalyses = TRUE, packageResults = TRUE, maxCores = 1)

I have downloaded the postgresql driver and the .jar file is available in the path to driver Specified “postgresql” in the connection string Run the execute function Correct me if I am wrong, Thank you in advance.

ablack3 commented 2 years ago

This looks like a bug in the study package (or possibly in another Hades package).

I'd guess the issue is a factor is being passed to checkmate::checkChoice somewhere inside execute.

dbms <- factor("postgresql")
checkmate::checkChoice(dbms, SqlRender::listSupportedDialects()$dialect)
#> [1] "Must be element of set {'sql server','oracle','postgresql','pdw','impala','netezza','bigquery','spark','sqlite','redshift'}, but types do not match (factor != character)"

Created on 2022-07-11 by the reprex package (v2.0.1)

Can you identify the where the error is coming from in your study package?

schuemie commented 2 years ago

This is a known issues related to older R versions (<4) and SqlRender. Please update SqlRender to the newly released v1.9.2.