python操作sqlite数据库

1. python 储存sqlite

import pandas as pd from sqlalchemy import create_engine engine = create_engine('sqlite:///test.db') data = {'name':['Bob','Bob1']} df = pd.DataFrame(data) df.to_sql('tb_test',engine)

2.python 读取sqlite

import pandas as pd from sqlalchemy import create_engine engine= create_engine('sqlite:///test.db') frame = pd.read_sql('tb_test', engine) print(frame)

3.cmd 访问 sqlite

3.1 访问目录-cd 路径

3.2 访问数据库-sqlite3 test.db

3.3 访问表名-.tables

3.4 执行sql语句(分号结尾)-select * from tb_test;

上一篇:Asp.Net Core 导入Excel数据到Sqlite数据库


下一篇:SQLite学习之常用SQL语句(02)