View source: R/get_table_names_and_info.R
get_table_names_and_info | R Documentation |
Retrieves comprehensive information about database tables including their names, row counts, and storage size metrics. This function provides database-specific implementations for different database systems.
get_table_names_and_info(connection)
connection |
A database connection object (e.g., from |
A data.table containing table information with columns:
Character. Name of the table
Numeric. Number of rows in the table
Numeric. Total size of the table in gigabytes
Numeric. Size of data in gigabytes
Numeric. Size of indexes in gigabytes
## Not run:
# Microsoft SQL Server example
con <- DBI::dbConnect(odbc::odbc(),
driver = "ODBC Driver 17 for SQL Server",
server = "localhost",
database = "mydb")
table_info <- get_table_names_and_info(con)
print(table_info)
DBI::dbDisconnect(con)
# PostgreSQL example
con <- DBI::dbConnect(RPostgres::Postgres(),
host = "localhost",
dbname = "mydb",
user = "user")
table_info <- get_table_names_and_info(con)
print(table_info)
DBI::dbDisconnect(con)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.