Hi Martijn,
Thanks for your input and offer of additional funtionality if needed.
Christian has created a modifed replacementPatterns.csv file, and we are working to have it fed into the code rather than the default file that was provided. I found this comment in the java source file SqlTranslate.java
* @param pathToReplacementPatterns
* The absolute path of the csv file containing the replacement patterns. If null, the csv file inside the jar is used.
However, based on our efforts (see details below), it appears that even if we define and pass a path to the new csv file designed to work with Netezza, the code still reads the one inside the jar. It would be great to turn on the functionality to pass this file? Or maybe we’re doing something wrong? Could you help trouble shoot?
First we modified the line of code in SqlRender.R
changed:
pathToReplacementPatterns <- system.file(“csv”,“replacementPatterns.csv”, package=“SqlRender”)
To:
pathToReplacementPatterns <-"/gpfs/users/sara/R_libs/replacementPatterns.csv"
sourced SqlRender.R and no difference in the output.
To test this further, we tried the following direct calls to the java TranslateSql.jar in an R session.
pathToReplacementPatterns <-"/gpfs/users/sara/R_libs/pathToReplacementPatterns.csv"
translatedSql <- rJava::J(“org.ohdsi.sql.SqlTranslate”)$translateSql(“select getdate() from SARA;”, “sql server”, “oracle”, pathToReplacementPatterns)
translatedSql
[1] “select SYSDATE from SARA;”
translatedSql <- rJava::J(“org.ohdsi.sql.SqlTranslate”)$translateSql(“select getdate() from SARA;”, “sql server”, “netezza”, pathToReplacementPatterns)
translatedSql
[1] “select getdate() from SARA;”
Whereas the expected answer for Netezza should be
“select current_date, from SARA;”
Let us know what you think.
Thanks,
Sara