SqlRender
This is an R package and Java library for rendering parameterized SQL, and translating it to different SQL dialects.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
This is an R package and Java library for rendering parameterized SQL, and translating it to different SQL dialects.
Basic Info
- Host: GitHub
- Owner: OHDSI
- License: other
- Language: R
- Default Branch: main
- Homepage: https://ohdsi.github.io/SqlRender
- Size: 13 MB
Statistics
- Stars: 82
- Watchers: 43
- Forks: 85
- Open Issues: 11
- Releases: 27
Topics
Metadata Files
README.md
SqlRender
SqlRender is part of HADES.
Introduction
This 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.
Features
- Supports a simple markup syntax for making SQL parameterized, and renders parameterized SQL (containing the markup syntax) to executable SQL
- The syntax supports defining default parameter values
- The syntax supports if-then-else structures
- 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)
- Can be used as R package, Java library, or as stand-alone executable through a command-line interface
Examples
This example shows the use of parameters, as well as SqlRender's {if} ? {then} : {else} syntax:
r
sql <- render("SELECT * FROM @a; {@b != ''}?{USE @b;}", a = "my_table", b = "my_schema")
will produce the variable sql containing this value:
"SELECT * FROM my_table; USE my_schema;"
subsequently running this code
r
sql <- translate(sql, "oracle")
will produce the variable sql containing this value:
"SELECT * FROM my_table; ALTER SESSION SET current_schema = my_schema;"
SqlDeveloper
The 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.
Technology
The SqlRender package is an R package wrapped around a Java library. The rJava package is used as interface.
The Java library is available as a JAR file.
System Requirements
Running the package requires R with the package rJava installed. Also requires Java 1.6 or higher. It 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.
Installation
R package
In R, to install the latest stable version, install from CRAN:
r
install.packages("SqlRender")
To install the latest development version, install from GitHub:
r
install.packages("remotes")
remotes::install_github("ohdsi/SqlRender", ref = "develop")
Once installed, you can try out SqlRender in a Shiny app that comes with the package:
r
library(SqlRender)
launchSqlRenderDeveloper()
Java library
You can fetch the JAR file in the inst/java folder of this repository, or use Maven:
- First add the SqlRender repository so that maven can find and download the SqlRender artifact automatically:
xml <repository> <id>ohdsi</id> <name>repo.ohdsi.org</name> <url>https://repo.ohdsi.org/nexus/content/repositories/releases</url> </repository> <repository> <id>ohdsi.snapshots</id> <name>repo.ohdsi.org-snapshots</name> <url>https://repo.ohdsi.org/nexus/content/repositories/snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository>2: Include the SqlRender dependency in your pom.xmlxml <dependency> <groupId>org.ohdsi.sql</groupId> <artifactId>SqlRender</artifactId> <version>1.9.2-SNAPSHOT</version> </dependency>
Command-line executable
You 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:
java -jar SqlRender.jar ?
User Documentation
Documentation can be found on the package website.
PDF versions of the documentation are also available: * Vignette: Using SqlRender * Package manual: SqlRender manual
Support
- Developer questions/comments/feedback: OHDSI Forum
- We use the GitHub issue tracker for all bugs/issues/enhancements
Contributing
Read here how you can contribute to this package.
License
SqlRender is licensed under Apache License 2.0
Development
SqlRender is being developed in R Studio.
Development status
Stable. The code is actively being used in several projects.
Acknowledgements
- This project is supported in part through the National Science Foundation grant IIS 1251151.
Owner
- Name: Observational Health Data Sciences and Informatics
- Login: OHDSI
- Kind: organization
- Website: http://ohdsi.org
- Repositories: 285
- Profile: https://github.com/OHDSI
GitHub Events
Total
- Create event: 3
- Release event: 2
- Issues event: 6
- Watch event: 2
- Issue comment event: 24
- Push event: 8
- Pull request event: 3
- Fork event: 8
Last Year
- Create event: 3
- Release event: 2
- Issues event: 6
- Watch event: 2
- Issue comment event: 24
- Push event: 8
- Pull request event: 3
- Fork event: 8
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| schuemie | s****e@o****g | 312 |
| Schuemie | M****I@i****m | 86 |
| Marc Suchard | m****d@g****m | 47 |
| Admin_mschuemi | A****i@i****m | 39 |
| Vitaly Koulakov | v****v@g****m | 38 |
| PGrafkin | p****a@g****m | 29 |
| ssuvorov-fls | s****v@o****m | 24 |
| Benjamin De Boe | b****e@i****m | 17 |
| Thomas White | T****e@M****t | 10 |
| Anthony Sena | a****5@i****m | 9 |
| myl-google | m****l@g****m | 9 |
| unknown | m****i@W****m | 9 |
| Anastasiia Klochkova | a****a@o****m | 8 |
| tsemharb | g****t@g****m | 7 |
| Michael Schmidt | M****2@g****m | 7 |
| alondhe | a****e@a****m | 6 |
| Tom White | t****m@c****m | 6 |
| Chris Knoll | c****l@o****g | 6 |
| Ajit Londhe | a****2@i****m | 5 |
| Alex Franken | a****e@r****g | 5 |
| Gennadiy Anisimov | g****v@a****u | 4 |
| Maria Pozhidaeva | m****a@o****m | 3 |
| Javier Gracia-Tabuenca | j****a@t****i | 3 |
| egillax | e****x@g****m | 3 |
| unknown | M****I@W****m | 2 |
| Ali Bellamine | c****t@a****e | 2 |
| alex-odysseus | a****o@o****m | 2 |
| Jamie Gilbert | J****2@i****m | 2 |
| Gowtham Rao | g****o | 2 |
| Andrey Ilatovskiy | A****v | 2 |
| and 17 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 114
- Total pull requests: 36
- Average time to close issues: 6 months
- Average time to close pull requests: 16 days
- Total issue authors: 53
- Total pull request authors: 19
- Average comments per issue: 2.66
- Average comments per pull request: 1.64
- Merged pull requests: 31
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 8
- Pull requests: 5
- Average time to close issues: 13 days
- Average time to close pull requests: 6 days
- Issue authors: 8
- Pull request authors: 2
- Average comments per issue: 2.0
- Average comments per pull request: 3.4
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ablack3 (11)
- alondhe (10)
- schuemie (6)
- pjlammertyn (6)
- pavgra (6)
- anthonysena (4)
- TomWhite-MedStar (4)
- MaximMoinat (4)
- katy-sadowski (3)
- SulevR (3)
- azimov (3)
- MichaelSchmidt82 (2)
- jreps (2)
- Tsemharb (2)
- egillax (2)
Pull Request Authors
- bdeboe (6)
- anthonysena (5)
- egillax (4)
- TomWhite-MedStar (3)
- ssuvorov-fls (3)
- javier-gracia-tabuenca-tuni (3)
- Tsemharb (3)
- alibell (2)
- MaximMoinat (2)
- alex-odysseus (2)
- ganisimov (2)
- ablack3 (2)
- azimov (1)
- TheCedarPrince (1)
- dependabot[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- cran 3,450 last-month
- Total docker downloads: 21,884
-
Total dependent packages: 11
(may contain duplicates) -
Total dependent repositories: 133
(may contain duplicates) - Total versions: 143
- Total maintainers: 1
proxy.golang.org: github.com/ohdsi/SqlRender
- Documentation: https://pkg.go.dev/github.com/ohdsi/SqlRender#section-documentation
- License: other
-
Latest release: v1.19.3
published 10 months ago
Rankings
proxy.golang.org: github.com/ohdsi/sqlrender
- Documentation: https://pkg.go.dev/github.com/ohdsi/sqlrender#section-documentation
- License: other
-
Latest release: v1.19.2
published over 1 year ago
Rankings
cran.r-project.org: SqlRender
Rendering Parameterized SQL and Translation to Dialects
- Homepage: https://ohdsi.github.io/SqlRender/
- Documentation: http://cran.r-project.org/web/packages/SqlRender/SqlRender.pdf
- License: Apache License 2.0
-
Latest release: 1.19.3
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/create-release v1 composite
- actions/download-artifact v2 composite
- actions/upload-artifact v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- r-lib/actions/setup-tinytex v2 composite
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- r-lib/actions/setup-tinytex v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- r-lib/actions/setup-tinytex v2 composite
- checkmate * imports
- rJava * imports
- rlang * imports
- knitr * suggests
- rmarkdown * suggests
- shiny * suggests
- shinydashboard * suggests
- stringr * suggests
- testthat * suggests