Discern Ancestry (3.5e Spell)

You pick any creature you can unambiguously identify, living or deceased, and can tell if the target has that creature as a direct ancestor (parent, grandparent, and so on, but not aunts or uncles). It does not reveal the exact relationship, nor does it even tell the number of intervening generations. This only detects blood relations, not adoption (barring powerful magic used at the adoption). Each round, you can pick a new target, a new ancestor, or both. This spell may be imbued into a Glyph   Glyph, but it does not allow the glyph to detect people, only to identify those it has already detected. The Glyph can identify the ancestry of everyone it detects at once, but it can only detect one specific ancestor.

This spell can be used as a cheap and unreliable race detector by specifying "the first human" or "the first goblin." Unreliable because this is D&D and D&D has a bunch of crossbreeding, so anything might have the first human as one of its ancestors. Also because you can rebuild yourself as a new race without changing your ancestry. I have no idea how that works, but it's been published.