Redivis API
User documentationredivis.com
  • Introduction
  • Referencing resources
  • Client libraries
    • redivis-js
      • Getting started
      • Examples
    • redivis-python
      • Getting started
      • Reference
        • redivis
          • redivis.current_notebook
          • redivis.file
          • redivis.organization
          • redivis.query
          • redivis.table
          • redivis.user
        • Dataset
          • Dataset.add_labels
          • Dataset.create
          • Dataset.create_next_version
          • Dataset.delete
          • Dataset.exists
          • Dataset.get
          • Dataset.list_tables
          • Dataset.list_versions
          • Dataset.query
          • Dataset.release
          • Dataset.remove_labels
          • Dataset.table
          • Dataset.unrelease
          • Dataset.update
          • Dataset.version
        • File
          • File.download
          • File.get
          • File.read
          • File.stream
        • Member
          • Member.add_labels
          • Member.exists
          • Member.get
          • Member.remove_labels
          • Member.update
        • Notebook
          • Notebook.create_output_table
        • Organization
          • Organization.dataset
          • Organization.list_datasets
          • Organization.list_members
          • Organization.member
        • Query
          • Query.download_files
          • Query.get
          • Query.list_files
          • Query.list_rows
          • Query.to_arrow_batch_iterator
          • Query.to_arrow_dataset
          • Query.to_arrow_table
          • Query.to_dataframe
          • Query.to_geopandas_dataframe
          • Query.to_dask_dataframe
          • Query.to_pandas_dataframe
          • Query.to_polars_lazyframe
        • Table
          • Table.add_files
          • Table.create
          • Table.delete
          • Table.download
          • Table.download_files
          • Table.get
          • Table.exists
          • Table.list_files
          • Table.list_rows
          • Table.list_uploads
          • Table.list_variables
          • Table.to_arrow_batch_iterator
          • Table.to_arrow_dataset
          • Table.to_arrow_table
          • Table.to_dataframe
          • Table.to_geopandas_dataframe
          • Table.to_dask_dataframe
          • Table.to_pandas_dataframe
          • Table.to_polars_lazyframe
          • Table.update
          • Table.upload
          • Table.variable
        • Upload
          • Upload.create
          • Upload.delete
          • Upload.exists
          • Upload.get
          • Upload.insert_rows
          • Upload.list_variables
          • Upload.to_*
        • Version
          • Version.dataset
          • Version.delete
          • Version.exists
          • Version.get
          • Version.previous_version
          • Version.next_version
        • User
          • User.dataset
          • User.list_datasets
          • User.workflow
          • User.list_workflows
        • Variable
          • Variable.get
          • Variable.exists
          • Variable.update
        • Workflow
          • Workflow.get
          • Workflow.exists
          • Workflow.list_tables
          • Workflow.query
          • Workflow.table
      • Examples
        • Listing resources
        • Querying data
        • Reading tabular data
        • Uploading data
        • Working with non-tabular files
    • redivis-r
      • Getting started
      • Reference
        • redivis
          • redivis$current_notebook
          • redivis$file
          • redivis$organization
          • redivis$query
          • redivis$table
          • redivis$user
        • Dataset
          • Dataset$create
          • Dataset$create_next_version
          • Dataset$delete
          • Dataset$exists
          • Dataset$get
          • Dataset$list_tables
          • Dataset$query
          • Dataset$release
          • Dataset$table
          • Dataset$unrelease
          • Dataset$update
        • File
          • File$download
          • File$get
          • File$read
          • File$stream
        • Notebook
          • Notebook$create_output_table
        • Organization
          • Organization$dataset
          • Organization$list_datasets
        • Query
          • Query$download_files
          • Query$get
          • Query$list_files
          • Query$to_arrow_batch_reader
          • Query$to_arrow_dataset
          • Query$to_arrow_table
          • Query$to_data_frame
          • Query$to_data_table
          • Query$to_tibble
          • Query$to_sf_tibble
        • Table
          • Table$add_files
          • Table$create
          • Table$delete
          • Table$download
          • Table$download_files
          • Table$get
          • Table$exists
          • Table$list_files
          • Table$list_uploads
          • Table$list_variables
          • Table$to_arrow_batch_reader
          • Table$to_arrow_dataset
          • Table$to_arrow_table
          • Table$to_data_frame
          • Table$to_data_table
          • Table$to_tibble
          • Table$to_sf_tibble
          • Table$update
          • Table$upload
          • Table$variable
        • Upload
          • Upload$create
          • Upload$delete
          • Upload$exists
          • Upload$get
          • Upload$insert_rows
          • Upload$list_variables
          • Upload$to_*
        • User
          • User$dataset
          • User$list_datasets
          • User$workflow
          • User$list_workflows
        • Variable
          • Variable$get
          • Variable$exists
          • Variable$update
        • Workflow
          • Workflow$get
          • Workflow$exists
          • Workflow$list_tables
          • Workflow$query
          • Workflow$table
      • Examples
        • Listing resources
        • Querying data
        • Reading tabular data
        • Uploading data
        • Working with non-tabular data
  • REST API
    • General structure
    • Authorization
    • Access
      • get
      • list
    • Datasets
      • delete
      • get
      • list
      • patch
      • post
    • Exports
      • download
      • get
      • post
    • Files
      • createSignedUrl
      • get
      • head
      • post
    • Members
      • get
      • list
    • Queries
      • get
      • post
      • listRows
    • ReadSessions
      • post
      • getStream
    • Tables
      • createTempUploads
      • delete
      • get
      • list
      • listRows
      • patch
      • post
    • Uploads
      • delete
      • get
      • insertRows
      • list
      • listRows
      • post
    • Variables
      • get
      • list
      • patch
    • Versions
      • delete
      • get
      • list
      • post
      • release
      • unrelease
    • Workflows
      • get
      • list
  • Resource definitions
    • Access
    • Dataset
    • Export
    • Member
    • Organization
    • Query
    • Table
    • Upload
    • User
    • Variable
    • Version
    • Workflow
Powered by GitBook
On this page
  • Upload$create(content = NULL, ...args) → Upload
  • Parameters:
  • Returns:
  • Examples

Was this helpful?

  1. Client libraries
  2. redivis-r
  3. Reference
  4. Upload

Upload$create

PreviousUploadNextUpload$delete

Last updated 1 month ago

Was this helpful?

Upload$create(content = NULL, ...args) →

Creates a new upload on a table and sends the provided data. The table must belong to an unreleased version, otherwise the function will throw an error. After calling create, the properties attribute on the Upload will be fully populated with the contents of the .

Parameters:

content : char | connection | raw | data.frame | arrow.Table | arrow.Dataset | sf.tibble The content of the upload. If a character vector, assumed to be the local path to the file. If a connection, can be a connection to a file, URL, or other stream. If a raw vector, assumed to be the contents of the file. Other formats are converted to parquet and then uploaded. This argument is required, unless either 1) the upload is of type="stream" , in which case data must be omitted (and sent later via upload.insert_rows()); or 2) a transfer_specification is provided. Can either be an open file object, string, or other file-like io stream.

type : str The type of file being uploaded. A list of valid types can be found in the . If uploading data from a particular variable (e.g., a data.frame), this parameter will be ignored, as Redivis internally converts this value to parquet and sets the type accordingly. Otherwise, if no type is provided, the type will be inferred based on any file extension in the upload's name, or an error will be thrown if the file extension isn't recognized.

transfer_specification : list<sourceType, sourcePath, identity> Used for transferring files from an external source, such as s3, a URL, or another table on Redivis. The values provided should match the specification for transferSpecification in the .

metadata : list<name=list<label, description, valueLabels>> Provide optional metadata for the variables in the file. This parameter is a named list of variable names mapping to the metadata for that variable, which is a named containing any of label=str, description=str, and valueLabels=list(value=str, label=str). Variable names are matched case-insensitive, and extraneous metadata entries are ignored.

if_not_exists : bool, default FALSE Only create the upload if an upload with this name doesn't already exist, otherwise, return the current upload. If set to False and an upload with the given name already exists (for the current version of the table), an error will be thrown, unless if rename_on_conflict=TRUE.

rename_on_conflict : bool, default FALSE By default, creating an upload with the same name as one that already exists for the particular table + version will raise an error. If set to True, a new upload will be created, with a counter added to its name to ensure name uniqueness across all uploads on the current version of the table. This option will be ignored if if_not_exists == TRUE. Only one of rename_on_conflict and replace_on_conflict may be TRUE.

replace_on_conflict : bool, default FALSE By default, creating an upload with the same name as one that already exists for the particular table + version will raise an error. If set to True, the previous upload with the same name will be deleted, and then this upload will be created. This option will be ignored if if_not_exists == TRUE. Only one of rename_on_conflict and replace_on_conflict may be TRUE.

skip_bad_records : bool, default FALSE Whether to ignore invalid or unparsable records. If FALSE, the upload will fail if it encounters any bad records. If True, the badRecordsCount attribute will be set in the upload properties.

allow_jagged_rows : bool, default FALSE Whether to allow rows that have more or fewer columns than the header row. Use caution when setting to true, as jagged rows often suggest a parsing issue; ignoring those errors could lead to data corruption.

remove_on_fail : bool, default FALSE If True, the upload will automatically be deleted if the import fails.

wait_for_finish : bool, default TRUE If True, wait for the upload to be fully imported before returning. If False, will return as soon as the data has been transferred to Redivis, but before it has been fully validated and processed. When False, remove_on_fail is ignored.

raise_on_fail : bool, default FALSE Whether to raise an exception if the upload fails.

progress : bool, default TRUE Whether to show progress bar.

delimiter : str Only relevant for delimited type, the character used as the delimiter in the data (often, a comma ,). If not specified, will be automatically inferred by scanning the first 10,000 records (up to 100MB) of the file.

has_header_row : bool, default TRUE Only relevant for the delimited type; whether the first row of the data is a header containing variable names.

has_quoted_newlines : bool Only relevant for the delimited type. Set to True if you know there are line breaks within any of the data values in the file, at the tradeoff of substantially reduced import performance. If not specified, will be automatically inferred by scanning the first 10,000 records (up to 100MB) of the file.

quote_character : str Only relevant for the delimited type. The character used to escape fields that contain the delimiter (most often " for compliant delimited files). If set to None, Redivis will attempt to auto-infer the quote character by scanning the first 10,000 records (up to 100MB) of the file.

escape_character : str Only relevant for delimited type. The character that precedes any occurrences of the quote character when it should be treated as its literal value, rather than the start or end of a quote sequence (typically, the escape character will match the quote character, but sometimes is represented as a backward slash \). If set to None, Redivis will attempt to auto-infer the quote character by scanning the first 10,000 records (up to 100MB) of the file.

Returns:

Examples

dataset <- redivis$user("user_name")$dataset("dataset_name", version="next")
table <- dataset$table("table_name")

upload <- table$upload()$create(
    "./data.csv",           # Path to file, data.frame, raw vector, etc
    type="delimited",       # Inferred from file extension if not provided
    remove_on_fail=True,    # Remove the upload if a failure occurs
    wait_for_finish=True,   # Wait for the upload to finish processing
    raise_on_fail=True      # Raise an error on failure
)
dataset <- redivis$user("user_name")$dataset("dataset_name", version="next")
table <- dataset$table("table_name")

dir_path <- "/path/to/data/directory"

for (filename in list.files(dir_path)){
    upload <- table$upload()$create(content=base::file.path(dir_path, filename))
}

schema : list<list<name, type>> Only relevant for uploads of type "stream". Defines an initial schema that will be validated on subsequent calls to . Takes the form: list(list(name="var_name", type="integer"), list(...), ...)

Upload
See more uploading data examples ->
Upload
upload.get resource definition
upload.post API documentation
upload.post payload
insertRows