0

我正在尝试将一些数据插入“计费帐户”表中,并尝试了以下方式。没有错误,数据没有被插入到表中。我在这里做错什么了吗?我正在使用 python 的 mysql.connector 模块来完成这项工作。

def billingaccounts(self,stag,prod):

    print "Updating the consilidated daily bills for stag and prod"
    cursor = self.testdb.cursor()
    stag = 87
    prod = 45
    now = '2016-06-03'
    to = 84
    cursor.execute('INSERT INTO iaas.billing_accounts (date, staging_account, production_acount, total) VALUES (%s, %s, %s, %s)',(now,stag,prod,to))
4

1 回答 1

1

您必须向服务器发送提交以查看更改。

https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlconnection-commit.html

于 2016-06-30T07:29:22.227 回答