Skip to content

Instantly share code, notes, and snippets.

@jackeyGao
Last active February 8, 2021 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jackeyGao/6a68100a0298895c6ef92869669a12c2 to your computer and use it in GitHub Desktop.
Save jackeyGao/6a68100a0298895c6ef92869669a12c2 to your computer and use it in GitHub Desktop.
全宋词爬虫数据模型脚本
# -*- 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