SqlRender

This is an R package and Java library for rendering parameterized SQL, and translating it to different SQL dialects.

https://github.com/ohdsi/sqlrender

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

hades

Keywords from Contributors

interpretability numeric genomics interactive serializer packaging network-simulation shellcodes hacking autograding
Last synced: 9 months ago · JSON representation

Repository

This is an R package and Java library for rendering parameterized SQL, and translating it to different SQL dialects.

Basic Info
Statistics
  • Stars: 82
  • Watchers: 43
  • Forks: 85
  • Open Issues: 11
  • Releases: 27
Topics
hades
Created about 12 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License

README.md

SqlRender

Build Status codecov.io CRAN_Status_Badge CRAN_Status_Badge

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:

  1. 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.xml xml <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

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

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

All Time
  • Total Commits: 721
  • Total Committers: 47
  • Avg Commits per committer: 15.34
  • Development Distribution Score (DDS): 0.567
Past Year
  • Commits: 55
  • Committers: 7
  • Avg Commits per committer: 7.857
  • Development Distribution Score (DDS): 0.436
Top Committers
Name Email 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...

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
bug (12) enhancement (6) help wanted (5) duplicate (3) exploratory (2) question (1) documentation (1) good first issue (1)
Pull Request Labels
dependencies (1)

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
  • Versions: 50
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.8%
Last synced: 10 months ago
proxy.golang.org: github.com/ohdsi/sqlrender
  • Versions: 49
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.8%
Last synced: 10 months ago
cran.r-project.org: SqlRender

Rendering Parameterized SQL and Translation to Dialects

  • Versions: 44
  • Dependent Packages: 11
  • Dependent Repositories: 133
  • Downloads: 3,450 Last month
  • Docker Downloads: 21,884
Rankings
Forks count: 1.0%
Dependent repos count: 1.8%
Stargazers count: 5.1%
Dependent packages count: 6.1%
Downloads: 6.7%
Average: 7.5%
Docker downloads count: 24.6%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/R_CMD_check_Hades.yaml actions
  • 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
.github/workflows/R_CMD_check_main_weekly.yaml actions
  • 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
.github/workflows/reverse_dependency.yml actions
  • 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
DESCRIPTION cran
  • checkmate * imports
  • rJava * imports
  • rlang * imports
  • knitr * suggests
  • rmarkdown * suggests
  • shiny * suggests
  • shinydashboard * suggests
  • stringr * suggests
  • testthat * suggests
pom.xml maven