07

Data Engineer · Step 7 of 8 · 7 min

Using AI assistants safely in data work

Get real speed from AI coding help without leaking data or shipping wrong SQL.

Where AI helps

AI assistants are good at first drafts: a SQL query, a regex, a Python function to parse a messy file, a test you forgot, documentation for a table. They are also useful for explaining an unfamiliar query or error message.

Used well, they remove the boring parts of the job. You still own the result.

Never paste real data

Data engineers often have access to customer and financial data. Do not paste rows of it into a public chatbot. Share the schema, column names and a few made-up rows instead. The model rarely needs real values to help.

Also never paste connection strings, passwords or API keys. If your company has an approved AI tool with a data agreement, use that one, and follow its rules.

Check SQL like you check a junior's work

AI-written SQL often runs and is still wrong. It may guess column meanings, use a join that duplicates rows, or ignore nulls. Run it on a small sample, check the row count and the grain, and compare one total with a number you trust.

Be most careful with anything that changes data: DELETE, UPDATE, DROP or MERGE. Read every line, run it on a copy first, and never let an assistant run these on production by itself.

AI in the data itself

More pipelines now call language models, for example to classify support tickets or extract fields from documents. Treat model output as untrusted input: validate its format, log what went in and out, and test on known examples.

Try it

Review an AI-written query

  1. 1.Give a chatbot only the schema of your coffee shop tables and ask for revenue by product by month.
  2. 2.Before running it, read it and predict the row count.
  3. 3.Run it in DuckDB and check one month by hand.
  4. 4.Ask the chatbot the prompt below and see whether it finds anything you missed.
Review this SQL as a senior data engineer. Check for join duplication, null handling, wrong grain and performance problems. Do not rewrite it yet; list the risks first. [paste SQL]
What is the safest way to get AI help with a query over customer data?

Check yourself

What is the safest way to get AI help with a query over customer data?

Read alongside