def event_promoters_insert_item(self, item):
        cursor = self.db.cursor()

        try:
            artist_event = item['artist_event']
            venue = item['venue']
            city_list = BoxString.normalize_city(item['city'])
            city = city_list[0]
            state = city_list[1]
            date_list = item['date']
            promoters_list = BoxString.normalize_promoters(item['promoters'])
            update_date = item["create_date"]

            for promoter in promoters_list:
                check_query = """SELECT COUNT(*) """ \
                              """FROM boxoffice_app_eventpromoter """ \
                              """WHERE event_id = (SELECT boxoffice_app_event.id """ \
                              """FROM boxoffice_app_event """ \
                              """WHERE artist_event_id=(SELECT id FROM boxoffice_app_artistevent where name = "%s") """ \
                              """AND venue_id=(SELECT id FROM boxoffice_app_venue where name = "%s") """ \
                              """AND city_id=(SELECT id FROM boxoffice_app_city where name = "%s" AND state = "%s") """ \
                              """AND dates = "%s" ) """ \
                              """AND promoter_id = (SELECT id """ \
                              """FROM boxoffice_app_promoter """ \
                              """WHERE name = "%s"); """ \
                              % (artist_event, venue, city, state, date_list, promoter)
                cursor.execute(check_query)
                for row in cursor:
                    if row[0] > 0:
                        print "%s exist in Event_Promoters" % '%s-%s' % (artist_event, promoter)
                    else:
                        query = """INSERT INTO boxoffice_app_eventpromoter VALUES (NULL, """ \
                                """(SELECT boxoffice_app_event.id """ \
                                """FROM boxoffice_app_event """ \
                                """WHERE artist_event_id=(SELECT id FROM boxoffice_app_artistevent where name = "%s") """ \
                                """AND venue_id=(SELECT id FROM boxoffice_app_venue where name = "%s") """ \
                                """AND city_id=(SELECT id FROM boxoffice_app_city where name = "%s" AND state = "%s") """ \
                                """AND dates = "%s" ), """ \
                                """(SELECT id """ \
                                """FROM boxoffice_app_promoter """ \
                                """WHERE name = "%s")); """ \
                                % (artist_event, venue, city, state, date_list, promoter)

                        cursor.execute(query)
                        self.db.commit()
        except ValueError as e:
            self.create_tables('Event_Promoters', item)
        except Exception as e:
            print 'Error ----------------------%s--------------------------------------------------' % 'Event_Promoters'
            print e.args
            print item
            self.create_error_log('Event_Promoters', item)
    def promoters_insert_item(self, item):
        cursor = self.db.cursor()

        promoters_list = BoxString.normalize_promoters(item['promoters'])

        for promoter in promoters_list:

            check_query = """SELECT COUNT(*) FROM boxoffice_app_promoter WHERE name = "%s";""" % promoter
            cursor.execute(check_query)

            for row in cursor:
                if row[0] > 0:
                    print "%s exist in Promoters" % promoter
                else:
                    query = """INSERT INTO boxoffice_app_promoter (name) VALUES ("%s");""" % promoter
                    cursor.execute(query)
                    self.db.commit()