INSERT INTO

Insert data into a native table.

GlareDB does not yet support UPDATE for native tables.

Syntax

INSERT INTO table_name VALUES (value)[, ... ];
Field Description
table_name Name of the table.
value A value set to insert into the table.

Examples

In this example we’ll first CREATE a simple users table, then insert two users into it.

CREATE TABLE public.users ( name text, email text );

INSERT INTO public.users AS VALUES
  ('Pris', 'pris@stratton.net'),
  ('Eldon Tyrell', 'ceo@tyrell.corp');

INSERT INTO Delta Tables

You can insert into Delta tables that you have added as external tables in GlareDB. Be sure to enable write permissions for this external table in GlareDB. When doing this, you will write data to the actual Delta table outside of GlareDB

CREATE EXTERNAL TABLE my_delta
FROM delta
OPTIONS (location => './my_delta');

ALTER TABLE my_delta SET ACCESS_MODE TO READ_WRITE;

INSERT INTO my_delta
  SELECT * FROM
    my_postgres.public.my_table a
  WHERE
    a.id > 1000

Check out the video below for a more hands-on example: