OHDSI Home | Forums | Wiki | Github

Error running aggregate covariate analyses (part of cohort characterization)

Hi everyone, I recently faced an error while trying to aggregate covariate analyses from the Characterization package. When executing the following codes:

  agc <- computeAggregateCovariateAnalyses(
      connectionDetails = connectionDetails,
      cdmDatabaseSchema = cdmDatabaseSchema,
      cdmVersion = 5.2,
      targetDatabaseSchema = targetDatabaseSchema,
      tempEmulationSchema = targetDatabaseSchema, 
      targetTable = "cohort",
      aggregateCovariateSettings = AggregateCovariateSettings_2,
      databaseId = "some_db_id",
      runId = 1
    )

The following error pops up:

Error Code: 0, SQL state: 42P07, Query: CREATE TAB***, Error running query: [TABLE_OR_VIEW_ALREADY_EXISTS] org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException: [TABLE_OR_VIEW_ALREADY_EXISTS] Cannot create table or view `some_cmd_schema`.`rbxuzagg_cohorts` because it already exists.
    Choose a different name, drop or replace the existing object, add the IF NOT EXISTS clause to tolerate pre-existing objects, or add the OR REFRESH clause to refresh the existing streaming table. 

However, there is no parameter like CreateIfNotExist in the computeAggregateCovariateAnalyses R function. Dropping the rbxuzagg_cohorts table does not work either because running the analyses will create this table again and show the same error. I can run the time-to-event and dechellenge-rechallenge analyses from the same package (Characterization). Only the aggregate covariate analyses codes do not work. Does anyone have any idea how to solve this? Any suggestion is helpful!

Thank you!

Hello, could you also share what database platform you are using for this?

Hello! I am using Microsoft Azure Databricks (also called Datalake). Thank you!

t