OHDSI / DataQualityDashboard

A tool to help improve data quality standards in observational data science.
https://ohdsi.github.io/DataQualityDashboard
Apache License 2.0
143 stars 96 forks source link

Error: Error executing SQL: org.postgresql.util.PSQLException: ERROR: relation "omop.cdm_source" does not exist #259

Closed YanLong-Cloud closed 2 years ago

YanLong-Cloud commented 3 years ago

I face this error even though i think i have the cdm set-up properly. image

I notice that the connection was not made when I broke up the code a little and the connection is "Connecting" and the code finishes running. image

Below is my code

Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = some_path)
library("DataQualityDashboard")
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "postgresql", 
                                                                user = "postgres", 
                                                                password = pw, 
                                                                server = "localhost/postgres", 
                                                                port = "5432",
                                                                extraSettings="")

cdmDatabaseSchema <- 'omop' # the fully qualified database schema name of the CDM
resultsDatabaseSchema <- "dqd" 
cdmSourceName <- "omop" # a human readable name for your CDM source
numThreads <- 1 # on Redshift, 3 seems to work well
sqlOnly <- FALSE # set to TRUE if you just want to get the SQL scripts and not actually run the queries
outputFolder <- some_path
outputFile <- "results.json"
verboseMode <- FALSE # set to TRUE if you want to see activity written to the console
writeToTable <- TRUE # set to FALSE if you want to skip writing to a SQL table in the results schema
checkLevels <- c("TABLE", "FIELD", "CONCEPT")
checkNames <- c() # Names can be found in inst/csv/OMOP_CDM_v5.3.1_Check_Desciptions.csv
tablesToExclude <- c() 

DataQualityDashboard::executeDqChecks(connectionDetails = connectionDetails, 
                                      cdmDatabaseSchema = cdmDatabaseSchema, 
                                      resultsDatabaseSchema = resultsDatabaseSchema,
                                      cdmSourceName = cdmSourceName, 
                                      numThreads = numThreads,
                                      sqlOnly = sqlOnly, 
                                      outputFolder = outputFolder, 
                                      outputFile = outputFile,
                                      verboseMode = verboseMode,
                                      writeToTable = writeToTable,
                                      checkLevels = checkLevels,
                                      tablesToExclude = tablesToExclude,
                                      checkNames = checkNames)
clairblacketer commented 2 years ago

Hi @YanLong-Cloud you also have to have the CDM_SOURCE table populated for the DQD to run.

clairblacketer commented 2 years ago

@YanLong-Cloud one thing I noticed too that in your connection string you need to include your schema "omop". On my local postgres instance my server would be postgres/omop. That could be why it is not picking up your cdm_source table.

YanLong-Cloud commented 2 years ago

I didnt use the connection string to connect eventually. I noticed the issue come with the fact the code in R only somehow only works when the schema is "public". I have no clue how to change the env variable in R so i just chose to name new instance as "public" since I didnt need multiple schemas.