Create or Append a Table from a Tibble or DBI-Backed Table
create_table.RdA thin wrapper that routes to either create_table_dbi() (for
dbplyr-backed lazy tables, class "tbl_dbi") or
create_table_tbl() (for in-memory tibbles / data frames), creating
a physical table in the target database/schema. Supports overwrite
and append write strategies and defers all heavy lifting to the
specific implementation.
Arguments
- .data
Tibble/data frame (in-memory) or a
dbplyr/DBI-backed lazy table (class"tbl_dbi").- .con
A valid
DBIconnection (DuckDB / MotherDuck).- database_name
Database name to create/use.
- schema_name
Schema name to create/use.
- table_name
Target table name to create or append to.
- write_type
Write strategy:
"overwrite"(drop/create) or"append"(insert rows). Defaults to"overwrite".
Value
Invisibly returns NULL. Side effect: writes a table to the database by
delegating to the appropriate helper.
Details
If
.datais adbplyrlazy table (class"tbl_dbi"), the call is delegated tocreate_table_dbi().If
.datais an in-memory tibble/data frame (class including"data.frame"), the call is delegated tocreate_table_tbl().Any other input classes trigger an error.
See also
Other db-manage:
alter_table_schema(),
copy_tables_to_new_location(),
create_database(),
create_if_not_exists_share(),
create_or_replace_share(),
create_schema(),
delete_and_create_schema(),
delete_database(),
delete_schema(),
delete_table(),
describe_share(),
drop_share(),
list_owned_shares(),
list_shared_with_me_shares(),
upload_database_to_md()