标签:error: das except ret host time turn 操作 --
python 达梦数据库操作流程import pandas as pd
import numpy as np
import datetime
import dmPython as dm
user_name = "dameng"
passwd = "admin"
server_name = "LOCALHOST"
server_port = 5236
def query_ustpf_time_breakpoint( wf_no ):
dm_conn = dm.connect( user=user_name, password=passwd, server=server_name, port=server_port )
dm_cursor = dm_conn.cursor()
sql_str = "select MAIN_LF_4H_PROC_TIME from WF_ST_PF_PARA where WINDPLANT_NO=%d;" % ( wf_no )
print( "func(query_ustpf_time_breakpoint):", sql_str )
try:
dm_cursor.execute( sql_str )
except Exception as e:
print( ‘func(query_ustpf_time_breakpoint) -- dm_cursor.execute(...) Error: ‘, e )
dt_breakpoint = dm_cursor.fetchall()
dm_cursor.close()
dm_conn.close()
if len( dt_breakpoint ) > 0:
return dt_breakpoint[0][0]
else:
return None
预先安装达梦数据库python语言支持包dmPython。
标签:error: das except ret host time turn 操作 --
原文地址:https://blog.51cto.com/weiyuqingcheng/2499200