Closed m32 closed 1 year ago
thanks for your updates. some of us are handed down these databases that were done with spaces which makes all aspects of development difficult.
It is not clear to me why this is needed. Name of the parameter does not need to match name of the column, for example you can do this:
sql = "INSERT INTO issue_7 (id, [my column]) VALUES (%(id)s, %(my_column)s)"
parameters = {'id': 1, 'my_column': 123}
cur.execute(sql, parameters)
or this:
sql = "INSERT INTO issue_7 (id, [my column]) VALUES (%s, %s)"
cur.execute(sql, (1, 123))
It is not clear to me why this is needed. Name of the parameter does not need to match name of the column, for example you can do this:
sql = "INSERT INTO issue_7 (id, [my column]) VALUES (%(id)s, %(my_column)s)" parameters = {'id': 1, 'my_column': 123} cur.execute(sql, parameters)
or this:
sql = "INSERT INTO issue_7 (id, [my column]) VALUES (%s, %s)" cur.execute(sql, (1, 123))
there is no problem when writing the query manually, but if you read the database structure and prepare a dictionary, there may be spaces in the names and column names are created from dictionary keys
I know it's a bad idea to have a space in the column name, but others allow it.