#212 Data governance 5.3 min
Data Ownership in Git: CODEOWNERS for Datasets
A five-line file in git says who owns each dataset. A script found a gap and a ghost team.
Give products an owner
Copy the code folder first. Add a new line at the end of the CODEOWNERS file that gives /datasets/products/ to @ana, then run python run.py. When I ran this, the products line showed @ana instead of NO OWNER, and the stale owner line for @shop/old-team was still printed. Why is the stale line still there?
A hint
Only one rule changed. Look at which owner the stale line names.
Retire the old team
In your copy, change @shop/old-team in CODEOWNERS to @shop/finance-data and run python run.py again. Predict first: will the stale owner line still appear? When I ran it, refunds.sql showed @shop/finance-data and no stale line was printed.
A hint
The stale check compares every owner in the file with the ACTIVE set in owners.py.
Swap the order of two lines
In your copy, rewrite CODEOWNERS so the line for /datasets/customers/*.sql comes first and the line for /datasets/customers/ comes second. Predict who owns customers.sql, then run python run.py. When I ran it, customers.sql showed @shop/data-platform. Explain the result using the last matching rule wins.
A hint
Both lines match customers.sql. Which one is read last now?
Add a file with no rule
In owners.py, add the path datasets/payments/payments.sql to the end of the FILES list. Predict what run.py prints for it and what the first line says about the number of files, then run it and compare. The CODEOWNERS file stays as it is.
A hint
No rule starts with datasets/payments/, so owners_of returns an empty list.
These tasks are for you to try on your own machine. Nothing is checked or saved.
What this does not show
Made-up repository, teams and file list; the matcher is simplified and differs from GitHub's, the script only prints, and a code owner is asked to review, not held accountable.
Up next in Data governance
More in Data governance
- #203 A Business Glossary in YAML With Four Python Checks
- #204 Tag PII Columns in Python, Including a False Positive
- #205 Column-Level Lineage from SQL with SQLGlot
- #208 Right to Erasure Across a Pipeline: Delete, Scan, Restore
- #209 UK GDPR Data Map as Code: A Practical Checklist
- #210 A Data Quality Scorecard That Shows a Hidden Failure
