Look at your
CREATE
statement:
CREATE TABLE test3(name VARCHAR(50),ageINT unsigned ...
There is a space missing between
age
and
INT
.
Further down you have:
cursor_obj.execute("alter table test3 add column %s %s(%s)",(new_column,data_type,size))
Which should have
.format
instead of the comma at the end of the format string. See
7. Input and Output — Python 3.10.6 documentation[
^].