使psycopg2更易于使用。

psyshort的Python项目详细描述


使psycopg2更易于使用。

用法:

frompsyshortimportPsyshortpsy=Psyshort(hostname="db.example.com",dbname="example_database",username="postgres_user",password="pa$$w0rd")select=psy.select(table="my_table",# Table's name (mandatory).fields=["id","first_name","last_name","phone",],# Fields to include in the result (optional).where="last_name = 'Smith'",# Select only rows where last_name = 'Smith' applies (optional).limit=1000,# Limit result to 1000 records (optional).order_by="first_name"# Order the result by 'first_name' column (optional).)result=select["result"]# The selected records.duration=select["duration"]# The duration of the operation.psy.insert(table="my_table",# Table's name (mandatory).columns=["first_name","last_name","phone",],# Columns by which to insert values (mandatory).row={"first_name":"John","last_name":"Smith","phone":"KL5-2390"}# Row to insert to the table (mandatory).)psy.disconnect()# Occurs on psy.__del__

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在AlertDialog builder标题右侧放置图标   安装weblogic server12时发生java获取错误。1在windows 10上   java无法导入:安卓。支持v7。小装置。Android Studio中的RecyclerView   java Android应用程序等待通知奇怪行为   java如何比较ArrayList中的整数元素?   java Quartz属性不会触发Quartz作业   java轻松地将许多JavaFX属性绑定到UINode   Maven插件管理器导致java错误消息的原因是什么?   JAXB解组错误后java文件被阻止   java如何在spark kafka流中创建消费者组并将消费者分配给消费者组   java Gps lat&long随机显示非常不准确的结果   java使用assest文件夹文件在Android上执行shell命令   java如何在客户端使用javascript提取文本   java扩展描述的distincts之和   java重写默认Spring数据REST配置   java SQL未命名参数语法   二进制搜索任务的java真实解决方案   java在一个多模块多数据源项目中,用什么正确的方式来指示将哪个数据源注入我的DAOs?