Exemple #1
0
    def push_sql(self, dictionary):
        '''
        Exports to alchemy
        '''
        new_record = Records()
        if "year_pub" in dictionary:
            new_record.year_pub = dictionary["year_pub"]

        if "country_code" in dictionary:
            new_record.country_code = dictionary["country_code"]

        if "language" in dictionary:
            new_record.language = dictionary["language"]

        if "key_term" in dictionary:
            new_record.key_term = dictionary["key_term"]

        if "region" in dictionary:
            new_record.region = dictionary["region"]

        session.add(new_record)
        if (self.numPushed % 500) == 0:
            session.commit()
        self.numPushed += 1