Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


SCDB (version 0.5.1)

table_exists: Test if a table exists in database

Description

This functions attempts to determine the existence of a given table. If a character input is given, matching is done heuristically assuming a "schema.table" notation. If no schema is implied in this case, the default schema is assumed.

Usage

table_exists(conn, db_table)

# S3 method for DBIConnection table_exists(conn, db_table)

Value

TRUE if db_table can be parsed to a table found in conn.

Arguments

conn

(DBIConnection(1))
Connection object.

db_table

(id-like object(1))
A table specification (coercible by id()).

Examples

Run this code
if (FALSE) { # requireNamespace("RSQLite", quietly = TRUE)
  conn <- get_connection()

  dplyr::copy_to(conn, mtcars, name = "mtcars", temporary = FALSE)
  dplyr::copy_to(conn, iris, name = "iris")

  table_exists(conn, "mtcars")    # TRUE
  table_exists(conn, "iris")      # FALSE
  table_exists(conn, "temp.iris") # TRUE

  close_connection(conn)
}

Run the code above in your browser using DataLab