Python Count Number Of Substring In Postgresql