Python Check Array Is Not Empty In Sql