A city detective was attacked by a dog during a drug investigation in Hazelwood and was shot by another officer trying to stop the animal.