简体   繁体   English

AWS RDS MySQL 数据库未从 pymysql 获取 INSERT 语句

[英]AWS RDS MySQL Database not taking INSERT statements from pymysql

So basically what the title says, I can connect to it and make the exact same queries with SQLelectron from my computer (where I am running the script).所以基本上正如标题所说,我可以连接到它并从我的计算机(我正在运行脚本)使用 SQLelectron 进行完全相同的查询。 It doesn't give me errors either, and I can make SELECT queries with sql electron from the same script.它也没有给我错误,我可以使用 sql electron 从同一个脚本进行 SELECT 查询。 What's more is my id column, (on which I have AUTO_Increment enabled) seems to jump to later values when I make the same insert statement from sql electron as if I actually inserted the row, but it does not actually insert.更重要的是,当我从 sql electron 发出相同的插入语句时,我的 id 列(我在其上启用了 AUTO_Increment)似乎跳转到后面的值,就好像我实际插入了行一样,但它实际上并没有插入。 Here is the code snippet:这是代码片段:

            sql = ['INSERT INTO liftdb.lifts',
                   '(Date, lift, weight)',
                   'VALUES',
                   '(%s, %s, %s)']
            cur.execute(' '.join(sql), (date, event['Lift'], event['Weight']))

Again, no errors or indication something went wrong.同样,没有错误或指示出现问题。

If your code is acting like theres been a change (by increasing the auto-increment) yet you cant notice any changes, thats a strong indication that you may have forgotten to commit the changes to the database.如果您的代码表现得好像发生了变化(通过增加自动增量)但您没有注意到任何变化,这强烈表明您可能忘记将更改提交到数据库。 (something like cur.commit() on the next line down. Assuming you have commited the changes, it could also be that whatever software youre using to check if the database has changed may need to be refreshed in-order to show the changes. (类似于下一行的cur.commit() 。假设您已提交更改,也可能是您用于检查数据库是否已更改的任何软件都可能需要刷新以显示更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pymysql无法插入到mysql数据库中 - insert into mysql database with pymysql failing to insert 如果使用Python(PyMySQL)不存在,则将值插入MySQL数据库 - Insert value to MySQL Database if not exist using Python(PyMySQL) 从 pymysql 更频繁地使用 connection.commit() 到 AWS RDS 是否更昂贵? - Is using connection.commit() from pymysql more frequently to AWS RDS more expensive? 连接到AWS RDS后,SQLAlchemy和PyMySQL拒绝连接到``本地主机'' - SQLAlchemy and PyMySQL refusing connection to 'localhost' after connecting to AWS RDS 在 rds 中部署的 mysql 数据库中插入数据时出现问题 - Issue while insert data in mysql database deployed in rds 有没有办法使用pymysql将数据帧插入mysql? - Is there a way to insert dataframe into mysql using pymysql? 如何使用 PyMySQL 将 Pandas Dataframe 插入 MySql - How to insert a Pandas Dataframe into MySql using PyMySQL 如何从本地的Django应用程序连接AWS RDS MySQL - How to connect AWS RDS MySQL from Django app from local 如何使用pymysql通过存储过程将pyodbc mssql查询返回的列表插入到mysql中 - How can I insert a list returned from pyodbc mssql query into mysql through stored procedure using pymysql AWS Glue 从 VPC 中的 RDS 数据库读取 - AWS Glue read from RDS database that's in VPC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM