Postgres Check If String Has Substring In Python 3