I am facing a strange problem right now. I am using pypyodbc to insert data into a test database hosted by AWS. This database that I created was by hand and did not imitate all relations and whatnot between tables. All I did was create a table with the same columns and the same datatypes as the original (let's call it master) database. When I run my code and insert the data it works in the test environment. Then I change it over to the master database and the code runs all the way through but no data is actually inputted. Is there any chance that there are security protocols in place which prevent me from inputting data in through the Python script rather than through a normal SQL query? Is there something I am missing?
Asked
Active
Viewed 54 times
1 Answers
3
It sounds like it's not pointing to the correct database. Have you made sure the connection information changes to point to the correct DB? So the server name is correct, the login credentials are good, etc.?

Michael Platt
- 1,297
- 12
- 25
-
Yes I just double checked, I even pull information from the database in my script It's just that nothing is inputted even though I include execute and commit lines. – Steven Setteducati Jr. Aug 18 '16 at 21:35
-
Have you tried logging into the DB as the user you are using for the ODBC connection and run the queries on their own to ensure that user is capable of doing what you need? If the connection info is good and it works on another machine I can't think of anything other than user permissions. – Michael Platt Aug 18 '16 at 21:37
-
( cc: @StevenSetteducatiJr. ) ... but if is was a matter of insufficient permissions then one would expect the code to throw an error like "INSERT permission was denied" or the like. (Unless the INSERTs were done in stored procedures that sometimes "bury" exceptions as discussed [here](http://stackoverflow.com/q/29377756/2144390).) Steven: Can we assume that you are not ignoring any exceptions that might come back from the "master" database? – Gord Thompson Aug 19 '16 at 15:28
-
@GordThompson I am not ignoring any exceptions thrown from the database at all since this is still in the bug testing phase – Steven Setteducati Jr. Aug 19 '16 at 16:41
-
@MichaelPlatt So I just realized that I hard coded the test database into the function that creates my insert into strings that are linked to a query so you were 100% right. Thank you so much! – Steven Setteducati Jr. Aug 19 '16 at 21:15
-
@StevenSetteducatiJr. Great!! I'm glad you were able to fix your problem. Best of luck with coding!! – Michael Platt Aug 19 '16 at 21:15
-
@MichaelPlatt I was only changing the string that is used for creating the odbc engine – Steven Setteducati Jr. Aug 19 '16 at 21:16