oxford-pharmacoepi / FluroquinolonesStudyathon

Fluroquinolones studyathon
0 stars 1 forks source link

Error calling `DrugExposureDiagnostics::executeChecks` - `table dbplyr_00n already exists and overwrite is FALSE!` #22

Closed vvcb closed 10 months ago

vvcb commented 10 months ago

A section of code in RunAnalysis.R, (Lines 77-L88) causes the same error when executing against Microsoft SQL Server despite numerous attempts all day. This is about a temporary table already existing - see below.

I have had no luck running this code despite trying all day. I have tried the following:

drug_diagnostics <-   DrugExposureDiagnostics::executeChecks(
  cdm = cdm,
  ingredients = drug_ingredients$concept_id,
  subsetToConceptId = unique(purrr::list_c(drug_concepts)),
  checks = c(
    "missing",
    "exposureDuration",
    "sourceConcept"
  ),
  verbose=TRUE)
Progress: getting descendant concepts of ingredient (1797513) used in database
Progress: getting descendant concepts of ingredient
Progress: adding drug strength info
Progress: limiting to concepts in the db
Progress: adding concept names
Created a temporary table named #dbplyr_013
Overall time taken: 0 minutes and 5 seconds
Time taken: 0 minutes and 5 seconds
Progress: getting drug strength for ingredient
Time taken: 0 minutes and 3 seconds
Progress: getting drug records for ingredient
Time taken: 0 minutes and 4 seconds
Progress: get concepts used
Time taken: 0 minutes and 3 seconds
Progress: sampling drug records
Error in `CDMConnector::computeQuery()`:
! table dbplyr_014 already exists and overwrite is FALSE!
Run `rlang::last_trace()` to see where the error occurred.
Warning messages:
1: Your SQL query is over 10,000 characters which can cause issues on some database platforms!
Try calling computeQuery earlier in your pipeline. 
2: Your SQL query is over 10,000 characters which can cause issues on some database platforms!
Try calling computeQuery earlier in your pipeline. 
edward-burn commented 10 months ago

Workaround implemented using random number to start temp tables (to avoid conflicts between users)