Skip to content

Instantly share code, notes, and snippets.

@jackeyGao

jackeyGao/crawl_songci_db.py Secret

Last active Aug 2, 2018
Embed
What would you like to do?
全宋词爬虫数据模型脚本
# -*- coding: utf-8 -*-
'''
File Name: db.py
Author: JackeyGao
mail: junqi.gao@shuyun.com
'''
from peewee import *
db = SqliteDatabase('ci.db')
class CiAuthor(Model):
value = IntegerField(primary_key=True)
name = CharField()
long_desc = TextField(null=True)
short_desc = TextField(null=True)
class Meta:
database = db # This model uses the "people.db" database.
class Ci(Model):
value = IntegerField(primary_key=True)
rhythmic = CharField()
author = CharField()
content = TextField(null=True)
class Meta:
database = db
#def delete_note():
# return Note.delete().execute()
#
#def delete_image():
# return Image.delete().execute()
def init_table():
db.connect()
db.create_tables([Ci, CiAuthor])
if __name__ == '__main__':
init_table()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.