r/ETL • • 13h ago

Automating CSV ingestion from Outlook emails into Databricks

10 Upvotes

Hi everyone,
I’m looking for suggestions on automating the ingestion of CSV files received as email attachments in Outlook into Databricks.
Has anyone implemented a solution where CSV attachments from Outlook emails are automatically picked up and ingested into Databricks through a pipeline?
I’m curious about the approaches you’ve used in production, whether through Microsoft Graph API, Power Automate, Logic Apps, or any other solution. I’d also appreciate insights on the best practices around authentication, handling multiple attachments, and orchestration.


r/ETL • • 1h ago

How do you prevent an AI coding agent from duplicating existing ETL logic?

1 Upvotes

I’ve been experimenting with Claude Code on unfamiliar ETL pipelines, and one risk keeps standing out.

An AI agent can generate a technically correct transformation while unknowingly creating a second implementation of an existing business rule.

The workflow I’m testing is:

  1. Map the pipeline before changing anything.
  2. Trace the target field or rule through upstream and downstream dependencies.
  3. Search for similar transformations across SQL, PySpark, notebooks, and configuration.
  4. Ask the agent to produce an implementation plan, not code.
  5. Review whether the plan reuses or extends the existing logic.
  6. Generate code and tests only after approving the plan.
  7. Compare the final changes with the approved scope.

The key lesson for me is that passing tests is not enough. Tests may confirm that the new logic works without revealing that the same rule already exists elsewhere.

I wrote a detailed article about this workflow here:

https://medium.com/@sudhansu.dash/before-i-let-claude-code-touch-my-etl-pipeline-487c7bc68e32

For engineers using AI coding tools, how are you checking for duplicated business logic before accepting generated changes?


r/ETL • • 12h ago

How to know if we should build data components as a code or use the available feature in Clause era?

Thumbnail reddit.com
1 Upvotes

r/ETL • • 10h ago

Re-running a load: append vs upsert vs partition overwrite. What happens when the source changes?

0 Upvotes

A job fails halfway and gets retried, or someone backfills a day. Whether that's safe depends on how the load writes. I ran a small test (SQLite 3.53.1, so only an illustration) with the same scenario for three strategies.

Source data for 2026-11-01: three rows with amounts 10, 20, 30 (sum 60). Later the source is corrected: id 2 becomes 25, and id 3 is removed.

A. Plain append, run twice:

(6, 120)    -- rows, sum

Every retry duplicates the data. Anything downstream that sums or counts is now wrong.

B. Upsert by primary key (INSERT ... ON CONFLICT(id) DO UPDATE):

run twice:                    (3, 60)
after source fix (id3 gone):  (3, 65)

Safe to re-run, and id 2 is updated. But id 3 is still there, since an upsert never deletes. The total is now 65 when the source says 35.

C. Partition overwrite (delete the day's rows, then insert, in one transaction):

run twice:                    (3, 60)
after source fix:             (2, 35)

Re-runs are safe, and the result matches the corrected source, including the deletion.

def load(rows, day):
    with db:                                   # one transaction
        db.execute("delete from t where day=?", (day,))
        db.executemany("insert into t values(?,?,?)", rows)

What this does not show, and where I'd be careful:

  • Overwrite needs a natural partition (a day, a batch id). If there isn't one, it's harder.
  • The delete+insert must be atomic. If your engine or tool doesn't give you a transaction (or an equivalent like swapping a partition), a failure between the two steps leaves the day empty.
  • Upsert can be right when the source never deletes, or when you handle deletes explicitly (soft-delete flags, tombstones, a separate reconciliation step).
  • This is a toy in one database. Warehouses and lake tables have their own mechanics (MERGE, partition overwrite, snapshots), so check yours.

My takeaway: decide how a re-run behaves before the first failure, and test it by running the job twice on purpose.

How do you handle deletes at the source in an upsert-based pipeline? And do you have a standard test, like "run twice and compare counts"?