{"id":14068069,"url":"https://github.com/OHDSI/SqlRender","last_synced_at":"2025-07-30T02:32:52.970Z","repository":{"id":15418575,"uuid":"18150828","full_name":"OHDSI/SqlRender","owner":"OHDSI","description":"This is an R package and Java library for rendering parameterized SQL, and translating it to different SQL dialects.","archived":false,"fork":false,"pushed_at":"2025-04-08T06:03:41.000Z","size":13609,"stargazers_count":82,"open_issues_count":12,"forks_count":84,"subscribers_count":43,"default_branch":"main","last_synced_at":"2025-05-24T21:01:53.361Z","etag":null,"topics":["hades"],"latest_commit_sha":null,"homepage":"https://ohdsi.github.io/SqlRender","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OHDSI.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"license_header_stub.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-03-26T19:24:46.000Z","updated_at":"2025-03-13T11:37:46.000Z","dependencies_parsed_at":"2023-09-26T17:02:52.375Z","dependency_job_id":"b5263fab-3846-4163-a387-11c53b30bd46","html_url":"https://github.com/OHDSI/SqlRender","commit_stats":{"total_commits":644,"total_committers":45,"mean_commits":"14.311111111111112","dds":0.5729813664596273,"last_synced_commit":"bd72fb4b5016874fed034f3254971840e01b9211"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/OHDSI/SqlRender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OHDSI%2FSqlRender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OHDSI%2FSqlRender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OHDSI%2FSqlRender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OHDSI%2FSqlRender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OHDSI","download_url":"https://codeload.github.com/OHDSI/SqlRender/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OHDSI%2FSqlRender/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267626684,"owners_count":24117700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hades"],"created_at":"2024-08-13T07:05:55.477Z","updated_at":"2025-07-30T02:32:52.641Z","avatar_url":"https://github.com/OHDSI.png","language":"R","funding_links":[],"categories":["数据库开发","HADES R Packages","R"],"sub_categories":["Database Connectivity"],"readme":"SqlRender\n=========\n\n[![Build Status](https://github.com/OHDSI/SqlRender/workflows/R-CMD-check/badge.svg)](https://github.com/OHDSI/SqlRender/actions?query=workflow%3AR-CMD-check)\n[![codecov.io](https://codecov.io/github/OHDSI/SqlRender/coverage.svg?branch=main)](https://app.codecov.io/github/OHDSI/SqlRender)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/SqlRender)](https://cran.r-project.org/package=SqlRender)\n[![CRAN_Status_Badge](https://cranlogs.r-pkg.org/badges/SqlRender)](https://cran.r-project.org/package=SqlRender)\n\nSqlRender is part of [HADES](https://ohdsi.github.io/Hades/).\n\nIntroduction\n============\nThis is an R package for rendering parameterized SQL, and translating it to different SQL dialects. SqlRender can also be used as a stand-alone Java library and a command-line executable.\n\nFeatures\n========\n- Supports a simple markup syntax for making SQL parameterized, and renders parameterized SQL (containing the markup syntax) to executable SQL\n- The syntax supports defining default parameter values\n- The syntax supports if-then-else structures\n- Has functions for translating SQL from one dialect (Microsoft SQL Server) to other dialects (Oracle, PostgreSQL, Amazon RedShift, Impala, IBM Netezza, Google BigQuery, Microsoft PDW, Snowflake, Azure Synapse, Apache Spark, SQLite, and InterSystems IRIS)\n- Can be used as R package, Java library, or as stand-alone executable through a command-line interface\n\nExamples\n========\nThis example shows the use of parameters, as well as SqlRender's {if} ? {then} : {else} syntax:\n\n```r\nsql \u003c- render(\"SELECT * FROM @a; {@b != ''}?{USE @b;}\", a = \"my_table\", b = \"my_schema\")\n```\n\nwill produce the variable `sql` containing this value: \n\n```\n\"SELECT * FROM my_table; USE my_schema;\"\n```\n\nsubsequently running this code\n\n```r\nsql \u003c- translate(sql, \"oracle\")\n```\n\nwill produce the variable `sql` containing this value: \n\n```\n\"SELECT * FROM my_table; ALTER SESSION SET current_schema =  my_schema;\"\n```\n\n## SqlDeveloper\n\nThe SqlDeveloper Shiny app is included in the SqlRender R package, and allows viewing the rendering and translation on the fly as you develop your SQL. The SqlDeveloper app is also available online [here](https://data.ohdsi.org/SqlDeveloper/).\n\nTechnology\n==========\nThe SqlRender package is an R package wrapped around a Java library. The rJava package is used as interface.\n\nThe Java library is available as a JAR file.\n\nSystem Requirements\n===================\nRunning the package requires R with the package rJava installed. Also requires Java 1.6 or higher.\nIt is highly recommended for best performance to use a version of R that is at least version 4 or higher otherwise, unexpected bugs or errors may occur.\n\nInstallation\n=============\n## R package\n\nIn R, to install the latest stable version, install from CRAN:\n\n```r\ninstall.packages(\"SqlRender\")\n```\n  \nTo install the latest development version, install from GitHub:\n\n```r\ninstall.packages(\"remotes\")\nremotes::install_github(\"ohdsi/SqlRender\", ref = \"develop\")\n```\n\nOnce installed, you can try out SqlRender in a Shiny app that comes with the package:\n\n```r\nlibrary(SqlRender)\nlaunchSqlRenderDeveloper()\n```\n\n## Java library\nYou can fetch the JAR file in the inst/java folder of this repository, or use Maven:\n\n1. First add the SqlRender repository so that maven can find and download the SqlRender artifact automatically:\n```xml\n\u003crepository\u003e\n  \u003cid\u003eohdsi\u003c/id\u003e\n  \u003cname\u003erepo.ohdsi.org\u003c/name\u003e\n  \u003curl\u003ehttps://repo.ohdsi.org/nexus/content/repositories/releases\u003c/url\u003e\n\u003c/repository\u003e\n\u003crepository\u003e\n  \u003cid\u003eohdsi.snapshots\u003c/id\u003e\n  \u003cname\u003erepo.ohdsi.org-snapshots\u003c/name\u003e\n  \u003curl\u003ehttps://repo.ohdsi.org/nexus/content/repositories/snapshots\u003c/url\u003e\n  \u003creleases\u003e\n      \u003cenabled\u003efalse\u003c/enabled\u003e\n  \u003c/releases\u003e\n  \u003csnapshots\u003e\n      \u003cenabled\u003etrue\u003c/enabled\u003e\n  \u003c/snapshots\u003e\n\u003c/repository\u003e\n```\n2: Include the SqlRender dependency in your pom.xml\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003eorg.ohdsi.sql\u003c/groupId\u003e\n\t\u003cartifactId\u003eSqlRender\u003c/artifactId\u003e\n\t\u003cversion\u003e1.9.2-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Command-line executable\nYou can fetch the JAR file in the inst/java folder of this repository, or use Maven as described above. Run this from the command line to get a list of options:\n```\njava -jar SqlRender.jar ?\n```\n\nUser Documentation\n==================\nDocumentation can be found on the [package website](https://ohdsi.github.io/SqlRender/).\n\nPDF versions of the documentation are also available:\n* Vignette: [Using SqlRender](https://github.com/OHDSI/SqlRender/raw/main/inst/doc/UsingSqlRender.pdf)\n* Package manual: [SqlRender manual](https://github.com/OHDSI/SqlRender/raw/main/extras/SqlRender.pdf) \n\nSupport\n=======\n* Developer questions/comments/feedback: \u003ca href=\"http://forums.ohdsi.org/c/developers\"\u003eOHDSI Forum\u003c/a\u003e\n* We use the \u003ca href=\"https://github.com/OHDSI/SqlRender/issues\"\u003eGitHub issue tracker\u003c/a\u003e for all bugs/issues/enhancements\n\nContributing\n============\nRead [here](https://ohdsi.github.io/Hades/contribute.html) how you can contribute to this package.\n\nLicense\n=======\nSqlRender is licensed under Apache License 2.0\n\nDevelopment\n===========\nSqlRender is being developed in R Studio.\n\n### Development status\n\nStable. The code is actively being used in several projects.\n\nAcknowledgements\n================\n- This project is supported in part through the National Science Foundation grant IIS 1251151.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOHDSI%2FSqlRender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOHDSI%2FSqlRender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOHDSI%2FSqlRender/lists"}