pylhb4mssql
pylhb4mssql 是我在工作过程中陆续整理的一个 Python mssql 工具包,里面就放在一个关于mssql操作的类及相关函数。与其说是一个正式的开源项目,不如说是我自己的“代码杂物间”——只不过把它打包了一下,方便在不同项目之间复用。
由于是个人使用为主,很多设计可能带着比较强的个人习惯,也未必是最优解。
如果您发现了问题或有更好的建议,非常欢迎指正。
申明:操作前请作好备份,本人对所有操作结果拥有所有解释权。
安装
pip install pylhb4mssql
🌺mypymssql模块
通过pymssql访问Microsoft SQL Server。
使用示例:
from pylhb4mssql.mypymssql import MyPyMSSQL
if __name__ == "__main__":
host="127.0.0.1"
prot=1433
user="sa"
password="fpsoft@123"
database="MyDB"
# 实例化
mssql=MyPyMSSQL(host,prot,user,password,database)
mssql.connect()
# mssql.connectWithWindowsAuth(r"localhost\sqlexpress")
print(mssql.Connected)
# Demo1:查询数据
sql="SELECT TOP 2 P_CusName,P_Tel FROM Dt_Customers WITH(NOLOCK)"
print("🌸Demot1:获取客户:")
humans=mssql.get(sql)
print(humans)
# Demo2:执行无参存储过程
(successed,msg) = mssql.execProc("Usp_TestNoArgs",())
print("🌸Demot2:执行无参存储过程(Usp_TestNoArgs):")
print(successed,msg)
# Demo3:执行带参存储过程
(successed,msg) = mssql.execProc("Usp_TestWithArgs",("192.168.5.8","443"))
print("🌸Demot3:执行带参存储过程(Usp_TestWithArgs):")
print(successed,msg)
# Demo4:执行存储过程并返回数据
(successed,msg,datas) = mssql.execProcGet("Usp_Test",())
print("🌸Demot4:执行存储过程并返回数据(Usp_Test):")
print(successed,msg,datas)
# 提交事务
mssql.commit()
# 关闭
mssql.close()
🌺License
本项目基于 MIT 许可证开源。MIT 是一种宽松的开源许可证,允许任何人免费使用、修改、分发本软件,包括用于商业用途。详见 LICENSE 文件。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pylhb4mssql-1.1.0.tar.gz
(4.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylhb4mssql-1.1.0.tar.gz.
File metadata
- Download URL: pylhb4mssql-1.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80bb9ddd810a78ded023702447ad0247ab2682ebde8bf0cc240a18dc779f9882
|
|
| MD5 |
7dd492d6626b3a1708835b00108c16d1
|
|
| BLAKE2b-256 |
b1cec321f774bca1f45d0079a9c621dafb8037fb289b097fd219369ae020646f
|
File details
Details for the file pylhb4mssql-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pylhb4mssql-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d78d4b5ff9abede9801f1badbe6c3f55c237670624d58facacd6eb6ef4cc2c03
|
|
| MD5 |
00b3f0fa2ef4826bf348a3d27c6bfe6b
|
|
| BLAKE2b-256 |
97a7ec855246c5f509d69ceff00d4925555e8f359e3780bd161ecd06331ae57d
|