DatabricksSqlClient | R Documentation |
Wraps the databricks-sql-connector
using reticulate.
API reference on Databricks docs
new()
Creates a new instance of this R6 class.
Note that this object is typically constructed via db_sql_client()
.
DatabricksSqlClient$new( host, token, http_path, catalog, schema, use_cloud_fetch, session_configuration, ... )
host
(character(1)
)
See db_sql_client()
.
token
(character(1)
)
See db_sql_client()
.
http_path
(character(1)
)
See db_sql_client()
.
catalog
(character(1)
)
See db_sql_client()
.
schema
(character(1)
)
See db_sql_client()
.
use_cloud_fetch
(logical(1)
)
See db_sql_client()
.
session_configuration
(list(...)
)
See db_sql_client()
.
...
Parameters passed to connection method
DatabricksSqlClient.
columns()
Execute a metadata query about the columns.
DatabricksSqlClient$columns( catalog_name = NULL, schema_name = NULL, table_name = NULL, column_name = NULL, as_tibble = TRUE )
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)
)
If TRUE
(default) will return tibble::tibble, otherwise returns
arrow::Table.
tibble::tibble or arrow::Table.
\dontrun{ client$columns(catalog_name = "defa%") client$columns(catalog_name = "default", table_name = "gold_%") }
catalogs()
Execute a metadata query about the catalogs.
DatabricksSqlClient$catalogs(as_tibble = TRUE)
as_tibble
(logical(1)
)
If TRUE
(default) will return tibble::tibble, otherwise returns
arrow::Table.
tibble::tibble or arrow::Table.
\dontrun{ client$catalogs() }
schemas()
Execute a metadata query about the schemas.
DatabricksSqlClient$schemas( catalog_name = NULL, schema_name = NULL, as_tibble = TRUE )
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)
)
If TRUE
(default) will return tibble::tibble, otherwise returns
arrow::Table.
tibble::tibble or arrow::Table.
\dontrun{ client$schemas(catalog_name = "main") }
tables()
Execute a metadata query about tables and views
DatabricksSqlClient$tables( catalog_name = NULL, schema_name = NULL, table_name = NULL, table_types = NULL, as_tibble = TRUE )
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)
)
If TRUE
(default) will return tibble::tibble, otherwise returns
arrow::Table.
tibble::tibble or arrow::Table.
execute()
Prepares and then runs a database query or command.
DatabricksSqlClient$execute(operation, parameters = NULL, as_tibble = TRUE)
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)
)
If TRUE
(default) will return tibble::tibble, otherwise returns
arrow::Table.
tibble::tibble or arrow::Table.
\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) ) }
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.
DatabricksSqlClient$execute_many( operation, seq_of_parameters = NULL, as_tibble = TRUE )
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)
)
If TRUE
(default) will return tibble::tibble, otherwise returns
arrow::Table.
tibble::tibble or arrow::Table.
\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) ) ) }
clone()
The objects of this class are cloneable with this method.
DatabricksSqlClient$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `DatabricksSqlClient$columns`
## ------------------------------------------------
## Not run:
client$columns(catalog_name = "defa%")
client$columns(catalog_name = "default", table_name = "gold_%")
## End(Not run)
## ------------------------------------------------
## Method `DatabricksSqlClient$catalogs`
## ------------------------------------------------
## Not run:
client$catalogs()
## End(Not run)
## ------------------------------------------------
## Method `DatabricksSqlClient$schemas`
## ------------------------------------------------
## Not run:
client$schemas(catalog_name = "main")
## End(Not run)
## ------------------------------------------------
## Method `DatabricksSqlClient$execute`
## ------------------------------------------------
## Not run:
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)
)
## End(Not run)
## ------------------------------------------------
## Method `DatabricksSqlClient$execute_many`
## ------------------------------------------------
## Not run:
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)
)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.