Splitgraph has been acquired by EDB! Read the blog post.

sgr csv import

sgr csv import [OPTIONS] REPOSITORY TABLE

Import a CSV file into a checked-out Splitgraph repository. This doesn't create a new image, use sgr commit after the import and any adjustments (e.g. adding primary keys or converting column types) to do so.

If the target table doesn't exist, this will create a new table.

If the target table does exist, this will try and patch the new values in by updating rows that exist in the current table (as per its primary key constraints) and inserting new ones. Rows existing in the current table but missing in the CSV won't be deleted.

If -r is passed, the table will instead be deleted and recreated from the CSV file if it exists.

Options

  • -f, --file FILENAME: File name to import data from, default stdin.
  • -r, --replace: Replace the table if it already exists.
  • -k, --primary-key TEXT: Use the specified column(s) as primary key(s)
  • -t, --override-type <TEXT TEXT>...: Explicitly set types of these columns to PG types
  • --encoding TEXT: Encoding to use for the CSV file
  • --separator TEXT: CSV separator to use
  • --no-header: Treats the first line of the CSV as data rather than a header.
  • --skip-schema-check: Skips checking that the dataframe is compatible with the target schema.

Table of contents