Skip to content

Invalid index creation SQL generated #809

Description

@dstansby

When generating SQL for sql server, near the end of the resulting SQL file there are several lines that just read drop index OMOP.dbo.;. This is invalid SQL - it's missing the table at the end, after the final ..

The error seems to be coming from this line:

indexName = indices[i,]$INDEX_NAME

Judging from a few lines below, INDEX_NAME should actually be index_name here.

Reproducible example:

library("Achilles")
library("DatabaseConnector")

dbms <- "sql server"
cdm_schema <- "OMOP.dbo"
results_schema <- "OMOP.dbo"

downloadJdbcDrivers("sql server", pathToDriver = tempdir())
connDetails <- DatabaseConnector::createConnectionDetails(
  dbms = "sql server",
  pathToDriver = tempdir()
)

Achilles::achilles(
  cdmVersion = "5.4",
  connectionDetails = connDetails,
  cdmDatabaseSchema = cdm_schema,
  resultsDatabaseSchema = results_schema,
  outputFolder = "achilles_output",
  sqlOnly = TRUE
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions