EHDEN / CatalogueExport

Exports the data from the OMOP-CDM that is necessary for the EHDEN Database Catalogue
Apache License 2.0
9 stars 6 forks source link

Error in executing CatalogueExport on Postgre CDM 5.3.1 #32

Closed paix30 closed 3 years ago

paix30 commented 3 years ago

Dear Peter, I can run CDMInspection, ACCHILLES, DQD but when I run the following code I get the error below. Appreciate your support.

if (!require("devtools")) install.packages("devtools")

To install the master branch

devtools::install_github("EHDEN/CatalogueExport") library(rJava) library(DatabaseConnector) library(SqlRender) library(ParallelLogger) library(CatalogueExport) Sys.setenv(DATABASECONNECTOR_JAR_FOLDER="C:/Users/brerd/Documents/R/win-library/4.0/DatabaseConnector/java") connectionDetails <- createConnectionDetails(dbms = "postgresql", server = "10.1.0.193/ehden", user = "xxx", password = "XXX", port="5432") catalogueExport(connectionDetails, cdmDatabaseSchema = "public", resultsDatabaseSchema="results", vocabDatabaseSchema = "public", numThreads = 1, createTable = TRUE, sqlOnly=TRUE, verboseMode=TRUE)

ERROR: Error in paste0("Running on server: ", connectionDetails$server, " on schema ", : cannot coerce type 'closure' to vector of type 'character'

PRijnbeek commented 3 years ago

Are you following these instructions: https://github.com/EHDEN/CatalogueExport/blob/master/extras/CodeToRun.R ?

Sys.setenv(DATABASECONNECTOR_JAR_FOLDER="C:/Users/brerd/Documents/R/win-library/4.0/DatabaseConnector/java") that is not correct. This is something new in DatabaseConnector Since a week or so. Have a look at OHDSI/DatabaseConnector for instructions around that. It should refer to the driver you download

paix30 commented 3 years ago

Hi Peter, I followed the instructions from the beginning once more but still getting the same error. I tried both on the CDM server and on a client laptop. I tried both with the Master and the @dev branch. I tried on R and RStudio.

I changed the connection detail with pathToDriver parameter as below. connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "postgresql", user = "postgres", password = "ehden", server = "10.1.0.193/ehden", port = "5432", pathToDriver = "C:/Users/brerd/Documents/R/win-library/4.0/DatabaseConnectorJars/java")

With this I can execute the query below: conn <- connect(connectionDetails) querySql(conn,"SELECT * FROM cdm_source") disconnect(conn)

I tried running catalogueExport without even setting connectionDetails and received the same error. From my understanding it gives the errror before creating a DB connection. Probably I'm missing something. Anything else you advise me to check?

ERROR: Error in paste0("Running on server: ", connectionDetails$server, " on schema ", : cannot coerce type 'closure' to vector of type 'character'

Btw, with this setting, I can run createIndices separately. It looks for "results.catalogue_results", though. Should I try to run the scripts separately? I already have Achilles results anyway.

createIndices(connectionDetails = connectionDetails, resultsDatabaseSchema = "results", outputFolder = "output")

PRijnbeek commented 3 years ago

https://github.com/EHDEN/CatalogueExport/blob/20d6a3a16b46628463923062d926565813dfa577/R/CatalogueExport.R#L111

It is due to a recent change in DatabaseConnector the connectionDetails$server does not work anymore and now should be server() will fix it and update version.

filipmaljkovic commented 3 years ago

I got the same problem on server, but everything works fine client-side. I would be grateful if we could get this in the codebase soon. :)

paix30 commented 3 years ago

Hi @filipmaljkovic, I downloaded the master code, deleted the problematic line, and executed it. All worked fine.