Python ORM BeePy V1.0 发布,简单易用
BeePy是基于Python的ORM工具; 让你使用Python访问数据库更简单!
Python ORM BeePy V1.0发布,简单易用.
主要功能
V1.0
1.框架使用统一的API操作DB;
2.单表查改增删(SUID);
3.开发人员只需关注框架的面向对象方式SUID API的使用即可;
4.表对应的实体类,可以只使用普通的实体类,不需要添加额外的表结构信息和框架相关信息;
5.可以根据配置信息,指定使用哪种数据库。
6.支持防sql注入;
7.支持原生sql;
8.框架负责管理连接,事务提交、回滚等的实现逻辑;
9.ORM的编码复杂度C(n)是O(1)。
快速开始:
1. 配置db连接信息
1.1.can custom your db Module
in bee.json or bee.properties set dbModuleName
#sqlite,mysql,Oracle,PostgreSQL内置支
bee.properties set SQLite:
bee.db.dbName=SQLite
bee.db.database =bee.db
1.2.if do not want to use the default config file(bee.json or bee.properties),
can set the db_config info yourself.
# #mysql
config = {
'dbName':'MySQL',
'host': 'localhost', # 数据库主机
'user': 'root', # 替换为您的 MySQL 用户名
'password': '', # 替换为您的 MySQL 密码
'database': 'bee', # 替换为您的数据库名称
'port':3306
}
honeyConfig= HoneyConfig()
honeyConfig.set_db_config_dict(config)
2. 使用BeePy操作数据库
class Orders:
id = None
name = None
remark = None
def __repr__(self):
return str(self.__dict__)
if __name__ == '__main__':
#select record
suid=Suid()
orderList=suid.select(Orders()) #select all
#insert
orders=Orders()
orders.id=104
orders.name="bee"
orders.remark="test"
suid=Suid()
suid.insert(orders)
#update/delete
orders=Orders3()
orders.name="bee130"
orders.ext="aaa" #实体没有字段,会被忽略。出去安全考虑
orders.id=10002
suid = Suid()
n1= suid.update(orders)
n2= suid.delete(orders)
print(n1)
print(n2)
待开发功能计划列表:
2.SQL 关键字,支持大小写;可通过配置确定;
3.批量插入;
4.order by
5.group by
6.createTable
7.index/unique
8.selectById
9.deleteById
10.List<String[]> selectString(T entity)
11.count
12.save
13.exist
14.selectFirst
15.复杂where条件支持; 添加Condition参数
16.支持直接返回Json格式查询结果;
17.多个ORM操作使用同一连接
18.处理查询的ResultSet结果;
19.转换PreparedStatement参数的类型
20.注册器、
21.拦截器、
22.自定义SQL支持
23.缓存支持
24.全局唯一
25.自动生成bean
诚邀您的加入!
如果您还想添加什么功能,请到评论区告诉我们。
项目首页: