Skip to content

Convert OHDSI PLP sql to duckdb format#19

Merged
amit-sharma-d4l merged 1 commit into
alp-dqdfrom
amit-sharma-d4l/duckdb-plp-translation
Apr 16, 2026
Merged

Convert OHDSI PLP sql to duckdb format#19
amit-sharma-d4l merged 1 commit into
alp-dqdfrom
amit-sharma-d4l/duckdb-plp-translation

Conversation

@amit-sharma-d4l

Copy link
Copy Markdown
Contributor

OHDSI PLP (PatientLevelPrediction) package creates some SQL statements that are not supported by duckdb. So, we need to convert them into appropriate format.

This commit translates DDL statements (CREATE TABLE) and other column data-types into appropriate duckdb versions.

…s that are not supported by duckdb. So, we need to convert them into appropriate format.

This commit translates DDL statements (CREATE TABLE) and other column data-types into appropriate duckdb versions.
Comment thread R/RenderSql.R
Comment on lines +166 to +184
if (grepl("\\bint\\b", statement, ignore.case = TRUE)) {
translation_done <- TRUE
statement <- gsub("\\bint\\b", "INTEGER", statement, ignore.case = TRUE)
}

if (grepl("VARCHAR\\s*\\(\\s*MAX\\s*\\)", statement, ignore.case = TRUE)) {
translation_done <- TRUE
statement <- gsub("VARCHAR\\s*\\(\\s*MAX\\s*\\)", "VARCHAR", statement, ignore.case = TRUE)
}

if (grepl("\\btext\\b", statement, ignore.case = TRUE)) {
translation_done <- TRUE
statement <- gsub("\\btext\\b", "TEXT", statement, ignore.case = TRUE)
}

if (grepl("\\bfloat\\b", statement, ignore.case = TRUE)) {
translation_done <- TRUE
statement <- gsub("\\bfloat\\b", "DOUBLE", statement, ignore.case = TRUE)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These conversions are handled by the default rules of duckdb dialect. It is not necessary to add them again here. I suggest to remove them.

@amit-sharma-d4l amit-sharma-d4l merged commit 6573c80 into alp-dqd Apr 16, 2026
0 of 7 checks passed
@amit-sharma-d4l amit-sharma-d4l deleted the amit-sharma-d4l/duckdb-plp-translation branch April 16, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants