to_sql: Write tables to Nuvolos.cloud

View source: R/sql_methods.R

to_sqlR Documentation

Write tables to Nuvolos.cloud

Description

Function to_sql(df, name, dbname, schemaname, if_exists, index, index_label, nanoseconds). Creates table in the connected nuvolos schema from an R dataframe. On Nuvolos the database and schema are by default the ones the user is working in, from local machine they need to be specified. The function supports bulk loading.

Usage

to_sql(
  df,
  name,
  dbname = NULL,
  schemaname = NULL,
  if_exists = "fail",
  index = TRUE,
  index_label = NULL,
  nanoseconds = FALSE
)

Arguments

df

Name of the R dataframe to be written to a table.

name

The name of the database table. It will only be quoted and case sensitive if it contains keywords or special chars

dbname

The name of the database to which data will be inserted.

schemaname

The name of the schema to which data will be inserted.

if_exists

How to behave if the table already exists. ‘fail’, ‘replace’, ‘append’, default ‘fail’

  • fail: Raise a ValueError.

  • replace: Drop the table before inserting new values.

  • append: Insert new values to the existing table.

index

bool, default True: Write DataFrame index as a column. Uses index_label as the column name in the table.

index_label

column label for index column(s). If None is given (default) and index is True, then the index names are used. A sequence should be given if the DataFrame uses MultiIndex.

nanoseconds

if True, nanosecond timestamps will be used to upload the data. Limits timestamp range from 1677-09-21 00:12:43.145224192 to 2262-04-11 23:47:16.854775807.

Examples

to_sql(df = df, name = "table", if_exists = 'replace', index = FALSE)
to_sql(df = df, name = "table", dbname = "space_1", schemaname = "test_schema", if_exists = 'replace', index = FALSE)


nuvolos-cloud/r-connector documentation built on March 29, 2025, 3:22 p.m.