Postgres Sql Using Python To Keep