def process_item(self, item, spider): sql_cnbeta = models.cnbeta() sql_cnbeta = models.map_orm_item(scrapy_item=item, sql_item=sql_cnbeta) self.session.add(sql_cnbeta) self.session.commit() self.session.close() return item
def process_item(self, item, spider): sql_cnbeta = models.cnbeta() sql_cnbeta = models.map_orm_item(scrapy_item=item, sql_item=sql_cnbeta) with scoped_session() as session: session.add(sql_cnbeta) return item
def process_item(self, item, spider): sql_mesh = models.Mesh() sql_mesh = models.map_orm_item(scrapy_item=item, sql_item=sql_mesh) try: self.session.merge(sql_mesh) self.session.commit() self.session.close() except: raise finally: return item