1

when I create a Delta table I can set some columns to be NOT NULL

CREATE TABLE [db_name.]table_name
  [(col_name1 col_type1 [NOT NULL], ...)]
  USING DELTA

Is there any way to set non null columns with koalas.to_table?

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
kismsu
  • 1,049
  • 7
  • 22

1 Answers1

1

It's not possible to do directly from koalas.to_table, but you can use ALTER TABLE statement to add the constraint after you wrote the data (full docs):

ALTER TABLE <table_name> CHANGE COLUMN <col_name> SET NOT NULL;

(for example, via spark.sql command)

Alex Ott
  • 80,552
  • 8
  • 87
  • 132