R/Andromeda.R
renderTranslateQuerySqlToAndromeda.Rd
This function renders, and translates SQL, sends it to the server, and returns the results as an ffdf object
renderTranslateQuerySqlToAndromeda(
connection,
sql,
andromeda,
andromedaTableName,
errorReportFile = file.path(getwd(), "errorReportSql.txt"),
snakeCaseToCamelCase = FALSE,
appendToTable = FALSE,
oracleTempSchema = NULL,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
integerAsNumeric = getOption("databaseConnectorIntegerAsNumeric", default = TRUE),
integer64AsNumeric = getOption("databaseConnectorInteger64AsNumeric", default = TRUE),
...
)
The connection to the database server created using either
connect()
or dbConnect()
.
The SQL to be send.
An open Andromeda object, for example as created
using Andromeda::andromeda()
.
The name of the table in the local Andromeda object where the results of the query will be stored.
The file where an error report will be written if an error occurs. Defaults to 'errorReportSql.txt' in the current working directory.
If true, field names are assumed to use snake_case, and are converted to camelCase.
If FALSE, any existing table in the Andromeda with the same name will be replaced with the new data. If TRUE, data will be appended to an existing table, assuming it has the exact same structure.
DEPRECATED: use tempEmulationSchema
instead.
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.
Logical: should 32-bit integers be converted to numeric (double) values? If FALSE
32-bit integers will be represented using R's native Integer
class.
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.
Invisibly returns the andromeda. The Andromeda object will have a table added with the query results.
This function calls the render
and translate
functions in the SqlRender
package
before calling querySqlToAndromeda()
.
if (FALSE) {
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
}