Python使用pymysql连接如何设置时区?

时间:2018-03-30 09:55:46

标签: python mysql pymysql

代码如下:

    import pymysql


    def connections(sql):
    conn = pymysql.connect(host='jumia-slave.cyvvaujdghdge.ap-northeast-1.rds.amadghsdgs.com', port=8890, user='user_ldhsg', passwd='g75ss437657543dgshfid7P1oGFog2vJ8b8', db='dgfgsd')
    cursor = conn.cursor()
    effect_row = cursor.execute(sql)
    result=cursor.fetchall()
    return result


    sql='''
SET time_zone = '+3:00';
SELECT
    FROM_UNIXTIME(add_time, '%Y%m%d'),
    COUNT(*) order_all
FROM
    nc_order
WHERE
    FROM_UNIXTIME(add_time, '%Y%m%d') > 20160811
GROUP BY
    FROM_UNIXTIME(add_time, '%Y%m%d')

'''

最后,结果显示:pymysql.err.ProgrammingError,

0 个答案:

没有答案