Skip to main content

Mr.Lee's MSSQL Helpers

Project description

pylhb4mssql

PyPI version GitHub stars GitHub license GitHub repo size GitHub forks

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()

Project details


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.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylhb4mssql-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pylhb4mssql-1.0.0.tar.gz.

File metadata

  • Download URL: pylhb4mssql-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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

Hashes for pylhb4mssql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dadaf6d5949d942bb7262659db70afb582d52733e239a2fdadec85c1069dfcab
MD5 b2b765b600f34ac8c1f8508bcbd6720c
BLAKE2b-256 e485962778d137470ecd8d8be20a8ef61e8c401a0c1f10e8a9bc6743ee316c60

See more details on using hashes here.

File details

Details for the file pylhb4mssql-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pylhb4mssql-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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

Hashes for pylhb4mssql-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8233ea2c49862b3025beaecd403e999195d41fbeef2605319385810479446aa7
MD5 65ad8e9897cf72d1295682b981a00907
BLAKE2b-256 a63b3fc51f01a415641b58e8cfa3f682b95c59f8b2cd34cb58a6a04ead23d387

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page