This commit is contained in:
27942
2025-10-13 11:22:02 +08:00
parent 48028edf56
commit ea085f244b
5 changed files with 68 additions and 256 deletions

View File

@@ -1,4 +1,4 @@
from peewee import *
# 连接到 SQLite 数据库,如果文件不存在会自动创建
db = SqliteDatabase('database.db')
db = SqliteDatabase(r'C:\Users\27942\Desktop\job\models\database.db')

Binary file not shown.

View File

@@ -14,20 +14,9 @@ class Weex(Model):
database = db
table_name = 'weex'
# 连接到数据库
db.connect()
# 创建表(如果表不存在)
db.create_tables([Weex])
# 示例数据
data = ['100', '101', '99', '100.5', 1]
# 使用 get_or_create 方法插入数据
Weex.get_or_create(
id=data[1],
open=data[0],
high=data[1],
low=data[2],
close=data[3]
)