MySQL Forums
Forum List  »  Connector/Python

5.2 Creating Tables Using Connector/Python code does not work
Posted by: Bill Orton
Date: July 25, 2016 05:50AM

Hello, I am working through the MySQL Connector/Python Developer Guide on this website and the code appears to be non functional. Specifically at

"http://dev.mysql.com/doc/connector-python/en/connector-python-example-ddl.html";

which is the url for the 5.2 Creating Tables Using Connector/Python section.
The problem I am experiencing is that the EMPLOYEES table is initially defined as a dictionary however the code that is used creates the tables by iterating over the items of the TABLES dictionary using the iteritems() method:

"for name, ddl in TABLES.iteritems():"

which raises the following error when run:

"AttributeError: 'dict' object has no attribute 'iteritems'".

Clearly it is not possible to iterate over a dictionary. Does anybody know how to correct this code. I am using Python 3.5. Thanks, George

Options: ReplyQuote


Subject
Written By
Posted
5.2 Creating Tables Using Connector/Python code does not work
July 25, 2016 05:50AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.