SQRL-package: Simple and Powerful ODBC Interfaces

SQRL-packageR Documentation

Simple and Powerful ODBC Interfaces

Description

Streamlines interactive exploratory work, and short-order ad hoc jobs, on ODBC data sources.

Details

Automatically generates a dedicated and like-named interface function to each ODBC DSN (Open DataBase Connectivity Data Source Name). These functions manage communications behind the scenes, whilst supporting multi-statement SQL scripts. Hybrid (SQRL) scripting syntax allows SQL with embedded R, thereby enabling parameterisation of queries, feedback of intermediate results, the addition of flow-control structures within and around SQL, and the use of libraries of stored scripts. Additional sources and interfaces can be defined at any time. The package is a wrapper about RODBC.

Author(s)

Mike Lee

See Also

sqrlSources, sqrlUsage

Examples

require(SQRL)

# Show (automatic) data sources.
sqrlSources()

## Not run: 
# If 'ratatoskr' were one of those sources (i.e.,
# if a DSN of that name was found), then a multi-
# statement query could be submitted like so:
ratatoskr("use yggdrasil; select messages from ",
          "vedfolnir where addressee = 'nidhogg' ",
          "limit ", 5)

# Submit a parameterised query from file.
ratatoskr("messages.sqrl", year = 950)

# Obtain help on usage.
ratatoskr("help")

## End(Not run)

# Define a new data source (interface).
sqrlSource("mysource",
           driver = "MYSQL ODBC 5.3 ANSI Driver",
           server = "localhost",
           user = "<uid>",
           password = "<pwd>")

## Not run: 
# Submit a query to the new source.
mysource("select * from database.table")

## End(Not run)

SQRL documentation built on Sept. 21, 2022, 9:13 a.m.