Jun-04-2020, 09:47 PM
I made the for loop so that it also detects changes in the columns, though I haven't tested it yet. For the original problem, I opened up cmder, ran a Python shell, and I get an error when I try to create a database
db_tables = {table[0]: table[1:] for table in cursor} for table, fields in tables.items(): if table not in db_tables or len(tuple(set(fields).difference(set(db_tables[table]))) + tuple(set(db_tables[table]).difference(set(fields)))) > 0: self.delete_table(table) self.cursor.execute("CREATE TABLE %s (%s)" % (table, ", ".join(fields)))
Error:Traceback (most recent call last):
File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\network.py", line 509, in open_connection
self.sock.connect(sockaddr)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\__init__.py", line 179, in connect
return MySQLConnection(*args, **kwargs)
File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\connection.py", line 95, in __init__
self.connect(**kwargs)
File "C:\Users\Sheep\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mysql\connector\abstracts.py", line 716, in connect
self._open_connection()
I don't know what to do to fix this error.