Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

5.2 Creating Tables Using Connector/Python code does not work (1 reply)

$
0
0
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

Viewing all articles
Browse latest Browse all 384

Trending Articles