Medium severityexecution
Power BI Refresh Error:
000826 (0A000)
What does this error mean?
A Snowflake stored procedure or scripting block exceeded the maximum number of statements allowed within a single transaction, causing the transaction to be aborted.
Common causes
- 1A Snowflake Scripting loop executes hundreds or thousands of DML statements inside one transaction
- 2A stored procedure iterates over a cursor and issues one INSERT or UPDATE per row
- 3A dbt macro generates a large batch of individual statements wrapped in a single explicit transaction
How to fix it
- 1Step 1: Replace row-by-row loops with set-based DML: use INSERT INTO ... SELECT or MERGE instead of looping INSERT per row.
- 2Step 2: Break large batch operations into smaller committed transactions (e.g., commit every 500 rows using EXECUTE IMMEDIATE 'COMMIT').
- 3Step 3: Use temporary tables to stage intermediate results and process them in one final set-based statement.
- 4Step 4: Review dbt models that call macros in loops — prefer dbt-core incremental strategies (merge, delete+insert) over custom looping macros.