Add variable substitution to query keys