isTable: Test if table present in the database.

Description Usage Arguments Value See Also Examples

Description

Tests each element if a table or a view exists in one of database schemas. Names could be just table name of schema followed by table name via '.'. ;

Usage

1
isTable(channel, tables, withNames = FALSE, allTables = NULL)

Arguments

channel

object as returned by odbcConnect.

tables

list of table names. Name may contain schema name followed by dot and table name or may be NULL. All visible schemas are checked when table specified without a schema. NULL corresponds to not a table.

withNames

logical indicates if table components included in the results.

allTables

a data frame containing table-like objects accessible from Aster. Usually obtained with sqlTables.

Value

logical vector indicating if corresponding name is table in Aster database. Special case when name contains a SQL query triggers NA value instead. This behavior is handy when checking if a table name corresponds to a table (or a view) or a SQL query instead. For example, to test if all names are either existing tables or views or SQL queries use something like this: result = isTable(...); if(all(result | is.na(result)) ...

See Also

getTableSummary

Examples

1
2
3
4
5
6
7
8
9
if(interactive()){
# initialize connection to Lahman baseball database in Aster 
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
                         server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")

isTable(conn, "pitching")        # TRUE 
isTable(conn, "pitch%")          # TRUE
isTable(conn, "public.pitching") # FALSE
}

teradata-aster-field/toaster documentation built on May 31, 2019, 8:36 a.m.