Contents

Create Delta Tables in Databricks

Introduction

I find myself googling the syntax for these commands all the time. So here’s some quick shortcuts:


Save df as delta table

# format
df.saveAsTable(name, format, mode, portitionBy)

# example
df.write.saveAsTable(delta_path, mode='overwrite')

modes

  • append: Append contents of this DataFrame to existing data.
  • overwrite: Overwrite existing data.
  • error or errorifexists: Throw an exception if data already exists.
  • ignore: Silently ignore this operation if data already exists.