Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

renderTranslateQuerySqlToAndromeda

Render, translate, and query to local Andromeda


Description

This function renders, and translates SQL, sends it to the server, and returns the results as an ffdf object

Usage

renderTranslateQuerySqlToAndromeda(
  connection,
  sql,
  andromeda,
  andromedaTableName,
  errorReportFile = file.path(getwd(), "errorReportSql.txt"),
  snakeCaseToCamelCase = FALSE,
  oracleTempSchema = NULL,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE),
  ...
)

Arguments

connection

The connection to the database server.

sql

The SQL to be send.

andromeda

An open connection to a Andromeda database, for example as created using andromeda.

andromedaTableName

The name of the table in the local Andromeda database where the results of the query will be stored.

errorReportFile

The file where an error report will be written if an error occurs. Defaults to 'errorReportSql.txt' in the current working directory.

snakeCaseToCamelCase

If true, field names are assumed to use snake_case, and are converted to camelCase.

oracleTempSchema

DEPRECATED: use tempEmulationSchema instead.

tempEmulationSchema

Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.

integer64AsNumeric

Logical: should 64-bit integers be converted to numeric (double) values? If FALSE 64-bit integers will be represented using bit64::integer64.

...

Parameters that will be used to render the SQL.

Details

This function calls the render and translate functions in the SqlRender package before calling querySqlToAndromeda.

Value

Invisibly returns the andromeda. The Andromeda database will have a table added with the query results.

Examples

## Not run: 
connectionDetails <- createConnectionDetails(dbms = "postgresql",
                                             server = "localhost",
                                             user = "root",
                                             password = "blah",
                                             schema = "cdm_v4")
conn <- connect(connectionDetails)
renderTranslatequerySqlToAndromeda(conn, 
                                   sql = "SELECT * FROM @schema.person",
                                   schema = "cdm_synpuf",
                                   andromeda = andromeda,
                                   andromedaTableName = "foo")
disconnect(conn)

andromeda$foo

## End(Not run)

DatabaseConnector

Connecting to Various Database Platforms

v4.0.2
Apache License
Authors
Martijn Schuemie [aut, cre], Marc Suchard [aut], Observational Health Data Science and Informatics [cph], Microsoft Inc. [cph] (SQL Server JDBC driver), PostgreSQL Global Development Group [cph] (PostgreSQL JDBC driver), Oracle Inc. [cph] (Oracle JDBC driver), Amazon Inc. [cph] (RedShift JDBC driver)
Initial release
2021-04-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.