table_exists: Test if a table exists in database

View source: R/table_exists.R

table_existsR Documentation

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 class 'DBIConnection'
table_exists(conn, db_table)

Arguments

conn

(DBIConnection(1))
Connection object.

db_table

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

Value

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

Examples


  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)


SCDB documentation built on Oct. 4, 2024, 1:09 a.m.