sqlalchemy.exc.DataError: (pyodbc.DataError) ('22001', '[22001] [IBM][System i Access ODBC Driver]Column 2: CWB0111 - Input data is too big to fit into field (30207) (SQLExecDirectW)')
[SQL: INSERT INTO enum_table (id, enum_data) VALUES (?, ?)]
[parameters: [(1, 'b%percent'), (2, 'réveillé'), (3, 'b'), (4, 'a%')]]
The Enum type calculates its max length as the max string length of the values provided in the Enum which is 9 for "réveillé". This causes the column to be created as
VARCHAR(9) CCSID 1208. On Db2 lengths are in bytes, not chars, and "réveillé" is 11 bytes in utf-8 so it fails to insert. We will need to adjust the Enum type somehow so that it calculates the length based on the length of the values encoded in utf-8.Refer to the Enum class: https://github.com/sqlalchemy/sqlalchemy/blob/rel_2_0/lib/sqlalchemy/sql/sqltypes.py#L1469
And test: https://github.com/sqlalchemy/sqlalchemy/blob/rel_2_0/lib/sqlalchemy/testing/suite/test_types.py#L1928