list_tables: List tables in a given schema

View source: R/pmap_db_utilities.R

list_tablesR Documentation

List tables in a given schema

Description

Function returns a character vector of all table names found in a given schema

Usage

list_tables(
  schema = "dbo",
  show_dimensions = FALSE,
  exact = FALSE,
  engine = default_engine
)

Arguments

schema

a string name of schema to search, default="dbo"

show_dimensions

logical (default FALSE); set this to TRUE to additionally return the size of the tables (number of rows and columns)

exact

logical (default FALSE); only relevant for show dimensions; if this is FALSE, then table dimensions will be estimated using sys.dm_db_partition_stats table, for which permission may not be provided to the user. In that case, this parameter can be set to TRUE to get exact dimensions, which will be slower (sometimes substantially so, if many tables, and those tables are large), but will be more accurate.

engine

a dbConnect connection object; by default will look in namespace for default_engine

Value

data.table of with column of table names, and optionally, columns for number of rows and columns

Examples

list_tables(engine=myconnection)
list_tables(schema="dbo",show_dimensions=TRUE, engine=myconnection)

lmullany/pmap_utilities documentation built on July 30, 2023, 8:54 a.m.