Skip to content

jamiefolson/rsql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package is an attempt to bring programmatic query construction as in SQLAlchemy to R. Tables are represented as S4 objects, with the $ operator overloaded to allow query construction:

> library(rsql)
> tab = rsql_table('test',c('x','y','z'))
> to_sql(tab$select())
[1] "SELECT test.x AS x,\n\ttest.y AS y,\n\ttest.z AS z\nFROM test"
> writeLines(to_sql(tab$select()))
SELECT test.x AS x,
  test.y AS y,
  test.z AS z
FROM test
> writeLines(to_sql(tab$select(.(a=x,b=y>5))$where(from(tab,.(z <5)))))
SELECT test.x AS a,
  test.y > 5 AS b
FROM test
WHERE test.z < 5

An ever-expanding list of SQL expressions are supported. For me information see the package documentation, especially for the rsql function.

About

An R package for programmatic construction of SQL, similar to SQLAlchemy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published