Have a look at the beginning of section 33 (in particular, 33.2) of the book "Natural operations in differential geometry" (pdf), for the Riemannian case only. It should work for the $SO(p,q)$ case also. There all $O(n)$-invariant tensors are described: The idea is to tensor with the metric or its inverse and then use the $GL(n)$ decomposition, i.e., involve traces and permutations.
Edit: Link corrected.

