get_column_info: Describe column of table in the DBMS

View source: R/tbl_dbi.R

get_column_infoR Documentation

Describe column of table in the DBMS

Description

The get_column_info() retrieves the column information of the DBMS table through the tbl_bdi object of dplyr.

Usage

get_column_info(df)

Arguments

df

a tbl_dbi.

Value

An object of data.frame.

Column information of the DBMS table

  • SQLite DBMS connected RSQLite::SQLite():

    • name: column name

    • type: data type in R

  • MySQL/MariaDB DBMS connected RMySQL::MySQL():

    • name: column name

    • Sclass: data type in R

    • type: data type of column in the DBMS

    • length: data length in the DBMS

  • Oracle DBMS connected ROracle::dbConnect():

    • name: column name

    • Sclass: column type in R

    • type: data type of column in the DBMS

    • len: length of column(CHAR/VARCHAR/VARCHAR2 data type) in the DBMS

    • precision: precision of column(NUMBER data type) in the DBMS

    • scale: decimal places of column(NUMBER data type) in the DBMS

    • nullOK: nullability

Examples


library(dplyr)
# connect DBMS
con_sqlite <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")

# copy heartfailure to the DBMS with a table named TB_HEARTFAILURE
copy_to(con_sqlite, heartfailure, name = "TB_HEARTFAILURE", overwrite = TRUE)

con_sqlite %>% 
  tbl("TB_HEARTFAILURE") %>% 
  get_column_info
  
# Disconnect DBMS   
DBI::dbDisconnect(con_sqlite)



dlookr documentation built on July 9, 2023, 6:31 p.m.