to_postgres | R Documentation |
There some cases where the Postgres servers are set up so that R is not able to build tables in schemas other than public. This function will delete any named tables that exit in both the public schema and the destination schema, then it will re-build the data into public then into the desired schema.
to_postgres(
df,
pg_conn,
schema_name = "public",
table_name,
primary_keys = "NA"
)
df |
Dataframe that will be pushed to Postgres, required. |
pg_conn |
required Postgres connection (PqConnection) created from RPostgres::Postgres(). JDBC connections will break this function. |
schema_name |
string Name of final schema if not public, default is public. |
table_name |
string Name of new table in Postgres, required. |
primary_keys |
string Fields to for primary keys, used in a SQL statement, default is NA. |
to_postgres() sends df to Postgres with options to create a primary index.
You will get a generic message from RPostgres, check Postgres server for the data to ensure that the data was transferred.
## Not run:
to_postgres(df = DF, pg_conn = db_CON, table_name = "data_upload", schema_name = "prod",
primary_keys = "group,date")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.