connect = psycopg2.connect(database=db_name, user=db_user, password=db_passwd, port=db_port) cur = connect.cursor() Sql_1 = "select * from conf_monitor order by cid" Sql_2 = "select * from conf_deg_spd order by cid" Sql_3 = "select * from conf_abnormal order by cid" Sql_4 = "select * from conf_abnormal_record" conf_monitor = get_conf(cur, Sql_1) conf_deg_spd = get_conf(cur, Sql_2) conf_abnormal = get_conf(cur, Sql_3) conf_abnormal_record = get_conf(cur, Sql_4)
时间: 2023-03-30 12:03:56 浏览: 210
psycopg2-2.8.2.tar_psycopg2_python_
这是一段 Python 代码,使用 psycopg2 模块连接数据库,并执行了四个 SQL 查询语句,分别查询了 conf_monitor、conf_deg_spd、conf_abnormal 和 conf_abnormal_record 四个表中的所有数据,并按照 cid 字段进行排序。
阅读全文