Pandas → T-SQL › concat

Pandas concat to UNION ALL

concat([a,b]) is UNION ALL. Missing columns become NULL. Names must match or you list them.

SELECT customer_id, email, 'UK' AS region FROM CustomersUk
UNION ALL
SELECT customer_id, email, 'IE' FROM CustomersIe;

UNION without ALL drops duplicates. Pandas concat does not. Most days you want ALL.

Canonical translation

SELECT customer_id, email, 'UK' AS region FROM CustomersUk
UNION ALL
SELECT customer_id, email, 'IE' FROM CustomersIe;

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free