MetricSign
EN|NLRequest Access
Medium severityexecution

Power BI Refresh Error:
TABLE_ALREADY_EXISTS

What does this error mean?

A CREATE TABLE statement failed because a table with the same name already exists in the target schema.

Common causes

  • 1A job was re-run and attempted to recreate a table without dropping it first
  • 2An idempotent CREATE TABLE IF NOT EXISTS clause is missing from the DDL
  • 3A Spark DataFrame saveAsTable call used SaveMode.ErrorIfExists (the default) on an existing table
  • 4A previous failed run partially created the table before failing

How to fix it

  1. 1Step 1: Add IF NOT EXISTS to the CREATE TABLE statement: CREATE TABLE IF NOT EXISTS catalog.schema.table ...
  2. 2Step 2: For DataFrame writes, use mode('overwrite') or mode('append') instead of the default ErrorIfExists: df.write.mode('overwrite').saveAsTable('...')
  3. 3Step 3: If the existing table is stale or incorrect, drop it first with DROP TABLE IF EXISTS.
  4. 4Step 4: Review job logic to ensure idempotency — a robust pipeline should be able to re-run without failures.

Frequently asked questions

What is the Spark equivalent of CREATE TABLE IF NOT EXISTS for DataFrame writes?

Use df.write.mode('ignore').saveAsTable('table_name') to skip the write if the table already exists, or mode('overwrite') to replace it.

Can I use REPLACE TABLE instead of DROP + CREATE?

Yes — CREATE OR REPLACE TABLE is supported in Databricks SQL and is atomic: it replaces the existing table definition and data in a single operation.

Other execution errors