Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql.cursors
- class MySQLPipeline(object):
- def __init__(self):
- self.connect = pymysql.connect(
- host='127.0.0.1',
- port=3306,
- db='xxxx',
- user='root',
- passwd='xxxx',
- charset='utf8',
- use_unicode=True)
- self.cursor = self.connect.cursor()
- def process_item(self, item, spider):
- self.cursor.execute("sql_insert_command")
- self.connect.commit()
- return item
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement