Wraps the databricks-sql-connector
using reticulate.
Methods
Method new()
Creates a new instance of this R6 class.
Note that this object is typically constructed via db_sql_client()
.
Usage
DatabricksSqlClient$new(
host,
token,
http_path,
catalog,
schema,
use_cloud_fetch,
session_configuration,
...
)
Arguments
host
(
character(1)
)
Seedb_sql_client()
.token
(
character(1)
)
Seedb_sql_client()
.http_path
(
character(1)
)
Seedb_sql_client()
.catalog
(
character(1)
)
Seedb_sql_client()
.schema
(
character(1)
)
Seedb_sql_client()
.use_cloud_fetch
(
logical(1)
)
Seedb_sql_client()
.session_configuration
(
list(...)
)
Seedb_sql_client()
....
Parameters passed to connection method
Method columns()
Execute a metadata query about the columns.
Usage
DatabricksSqlClient$columns(
catalog_name = NULL,
schema_name = NULL,
table_name = NULL,
column_name = NULL,
as_tibble = TRUE
)
Arguments
catalog_name
(
character(1)
)
A catalog name to retrieve information about. The%
character is interpreted as a wildcard.schema_name
(
character(1)
)
A schema name to retrieve information about. The%
character is interpreted as a wildcard.table_name
(
character(1)
)
A table name to retrieve information about. The%
character is interpreted as a wildcard.column_name
(
character(1)
)
A column name to retrieve information about. The%
character is interpreted as a wildcard.as_tibble
(
logical(1)
)
IfTRUE
(default) will return tibble::tibble, otherwise returns arrow::Table.
Returns
tibble::tibble or arrow::Table.
Method catalogs()
Execute a metadata query about the catalogs.
Arguments
as_tibble
(
logical(1)
)
IfTRUE
(default) will return tibble::tibble, otherwise returns arrow::Table.
Returns
tibble::tibble or arrow::Table.
Method schemas()
Execute a metadata query about the schemas.
Arguments
catalog_name
(
character(1)
)
A catalog name to retrieve information about. The%
character is interpreted as a wildcard.schema_name
(
character(1)
)
A schema name to retrieve information about. The%
character is interpreted as a wildcard.as_tibble
(
logical(1)
)
IfTRUE
(default) will return tibble::tibble, otherwise returns arrow::Table.
Returns
tibble::tibble or arrow::Table.
Method tables()
Execute a metadata query about tables and views
Usage
DatabricksSqlClient$tables(
catalog_name = NULL,
schema_name = NULL,
table_name = NULL,
table_types = NULL,
as_tibble = TRUE
)
Arguments
catalog_name
(
character(1)
)
A catalog name to retrieve information about. The%
character is interpreted as a wildcard.schema_name
(
character(1)
)
A schema name to retrieve information about. The%
character is interpreted as a wildcard.table_name
(
character(1)
)
A table name to retrieve information about. The%
character is interpreted as a wildcard.table_types
(
character()
)
A list of table types to match, for example"TABLE"
or"VIEW"
.as_tibble
(
logical(1)
)
IfTRUE
(default) will return tibble::tibble, otherwise returns arrow::Table.
Returns
tibble::tibble or arrow::Table.
Method execute()
Prepares and then runs a database query or command.
Arguments
operation
(
character(1)
)
The query or command to prepare and then run.parameters
(
list()
)
Optional. A sequence of parameters to use with the operation parameter.as_tibble
(
logical(1)
)
IfTRUE
(default) will return tibble::tibble, otherwise returns arrow::Table.
Returns
tibble::tibble or arrow::Table.
Method execute_many()
Prepares and then runs a database query or command using all parameter sequences in the seq_of_parameters argument. Only the final result set is retained.
Arguments
operation
(
character(1)
)
The query or command to prepare and then run.seq_of_parameters
(
list(list())
)
A sequence of many sets of parameter values to use with the operation parameter.as_tibble
(
logical(1)
)
IfTRUE
(default) will return tibble::tibble, otherwise returns arrow::Table.
Returns
tibble::tibble or arrow::Table.
Examples
## ------------------------------------------------
## Method `DatabricksSqlClient$columns`
## ------------------------------------------------
if (FALSE) { # \dontrun{
client$columns(catalog_name = "defa%")
client$columns(catalog_name = "default", table_name = "gold_%")
} # }
## ------------------------------------------------
## Method `DatabricksSqlClient$catalogs`
## ------------------------------------------------
if (FALSE) { # \dontrun{
client$catalogs()
} # }
## ------------------------------------------------
## Method `DatabricksSqlClient$schemas`
## ------------------------------------------------
if (FALSE) { # \dontrun{
client$schemas(catalog_name = "main")
} # }
## ------------------------------------------------
## Method `DatabricksSqlClient$execute`
## ------------------------------------------------
if (FALSE) { # \dontrun{
client$execute("select 1")
client$execute("select * from x.y.z limit 100")
client$execute(
operation = "select * from x.y.z where a < %(threshold)s limit 1000",
parameters = list(threshold = 100)
)
} # }
## ------------------------------------------------
## Method `DatabricksSqlClient$execute_many`
## ------------------------------------------------
if (FALSE) { # \dontrun{
client$execute_many(
operation = "select * from x.y.z where a < %(threshold)s limit 1000",
seq_of_parameters = list(
list(threshold = 100),
list(threshold = 200),
list(threshold = 300)
)
)
} # }