国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

利用python向mysql數(shù)據(jù)庫插入timestamp

2023-05-21 22:23 作者:青陽小棧  | 我要投稿

利用python向mysql數(shù)據(jù)庫插入timestamp

  • def insert_install_service_info(serviceName,nodeID,nodeIP='9.42.83.54'):

  • ? ?conn = MySQLdb.connect(host='172.17.46.15',user='root',passwd='huxin2010')

  • ? ?curs = conn.cursor()

  • ? ?serviceNode = {}

  • ? ?try:

  • ? ? ? ?conn.select_db('nodeInfo')

  • ? ?except Exception:

  • ? ? ? ?logger.error("the database you find does not exist!")

  • ? ?try:

  • ? ? ? ?sql = "insert into service3 values('NULL',%s,%s,%s,%s)"

  • ? ? ? ?now = datetime.datetime.now()

  • ? ? ? ?now = now.strftime("%Y-%m-%d %H:%M:%S")

  • ? ? ? ?values = [serviceName,nodeID,nodeIP,now]

  • ? ? ? ?curs.execute(sql,values)

  • ? ?except Exception:

  • ? ? ? ?logger.error("error: insert data fail")

  • ? ?conn.commit()

  • ? ?curs.close()

  • ? ?conn.close()


利用python向mysql數(shù)據(jù)庫插入timestamp的評論 (共 條)

分享到微博請遵守國家法律
老河口市| 天气| 平塘县| 武胜县| 宁武县| 扎兰屯市| 芦山县| 云霄县| 吉安县| 临漳县| 固阳县| 荣昌县| 密云县| 浙江省| 南开区| 新田县| 临洮县| 萝北县| 江油市| 重庆市| 洛川县| 如东县| 汝城县| 长海县| 丰顺县| 开阳县| 平谷区| 清苑县| 余姚市| 米泉市| 白玉县| 信宜市| 龙游县| 大安市| 靖州| 信宜市| 宁明县| 邯郸县| 琼中| 牡丹江市| 阿鲁科尔沁旗|