hanaml.ConnectionContext.Rd
ConnectionContext
hanaml.ConnectionContext(
dsn = "",
username = "",
password = "",
odbc = TRUE,
jdbcDriver = NULL,
rodbc = FALSE,
encrypt = NULL,
validateCertificate = NULL,
autocommit = FALSE,
...
)
character
A registered data source name for ODBC or <host>:<port> for JDBC.
character
User name.
character
Password.
logical, optional
Whether to use ODBC or JDBC database connectivity.
For ODBC connectivity, hana.ml.r supports two library "odbc"(recommended) and "RODBC".
Defaults to TRUE.
character, optional
Path to the JDBC driver. Only valid for JDBC.
logical, optional
Whether to use library 'RODBC' for ODBC database connectivity. If TRUE, use RODBC. Else, use odbc.
This parameter is only valid for using ODBC connectivity.
Defaults to FALSE.
logical, optional
Whether or not to encrypt the connection.
Valid only for JDBC.
logical, optional
Whehter or not to validate certifcate when connection to the server.
Valid only for JDBC.
logical, optional
Whether or not setting a JDBC connection to autocommit mode.
Valid only for JDBC.
Defaults to FALSE.
Object of R6Class
with methods for ConnectionContext.
Represents a connection to a SAP HANA system. ConnectionContext includes methods for creating DataFrames from data on SAP HANA. DataFrames are tied to a ConnectionContext, and are unusable once their ConnectionContext is closed.
close()
Closes the existing connection.
Usage:
conn$close()
sql(sql)
Returns a DataFrame representing a query.
Usage:
df <- conn$sql("SELECT T.A, T2.B FROM T, T2 WHERE T.C=T2.C")
Arguments:
sql, character
: Sql Query.
Returns:
DataFrame
Dataframe for the query.
GetCurrentSchema()
Returns the name of current working schema in the database.
Usage: conn$GetCurrentSchema()
Returns:
character
Current schema name.
hana.version(getMajor=FALSE, ...)
Returns the version or major version of SAP HANA.
Usage: conn$hana.version()
Arguments:
getMajor, logical
: if TRUE, return the major nubmer of SAP HANA version. Defaults to FALSE.
Returns:
character or integer
The version of SAP HANA or major version if getMajor is TRUE.
table(table, schema = NULL)
Returns a DataFrame representing a table.
Usage:
df1 <- conn$table("MY_TABLE")
df2 <- conn$table("MY_OTHER_TABLE", schema="MY_SCHEMA")
Arguments:
table, character
: Table Name(without schema).
schema, character, optional
: Schema name.
Defaults to the ConnectionContext's current schema if not provided.
Returns:
DataFrame
DataFrame selecting data from that table.