-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
数据存储文件存储,数据库存储文件存储,数据库存储
Description
select
import json
def selectRecords(db):
cursor = db.cursor()
sql = 'select name,age,salary from persons order by age desc'
cursor.execute(sql)
results = cursor.fetchall()
print(type(results))
fields = ['name','age','salary']
records = []
for row in results:
records.append(dict(zip(fields,row)))
return json.dumps(records)
print(selectRecords(db))
db.close()
Metadata
Metadata
Assignees
Labels
数据存储文件存储,数据库存储文件存储,数据库存储