Due to lack of training samples, overfitting is a severe problem in fault diagnosis for mechanical devices, especially for rotating machinery. In this paper, a graph neural network (GNN) method with one-shot learning is proposed for fault diagnosis of rotating machinery. Convolutional Neural Network (CNN) is applied to extract the feature vectors and generate codes for one-shot learning. With adjacency matrix in GNN, the proposed method can achieve fault classification for rotating machinery with small dataset. Rotate vector (RV) reducer of the industrial robot and bearing of the rotating shaft were chosen as experimental subjects. Experimental results show the high accuracy of classification in both experiments with the proposed method. To further verify the efficiency of this method, Siamese Net, Matching Net and SAE+RF were chosen as the comparisons. The results indicate the proposed method outperforms all the selected methods for fault classification in both rotating machineries.