String types have an optional length field, but for DDL in Db2, CHAR/VARCHAR/etc require a length be specified. The docs say that in that case an exception should be raised, but we currently do not do this and instead just assume the user passed a valid length and insert it in to the statement, which causes an SQL parser error: SQL0104 - Token ( was not valid.
https://docs.sqlalchemy.org/en/14/core/type_basics.html#sqlalchemy.types.String.params.length
String types have an optional length field, but for DDL in Db2, CHAR/VARCHAR/etc require a length be specified. The docs say that in that case an exception should be raised, but we currently do not do this and instead just assume the user passed a valid length and insert it in to the statement, which causes an SQL parser error:
SQL0104 - Token ( was not valid.
We need to add code similar to https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3/lib/sqlalchemy/dialects/mysql/base.py#L2214-L2220 for all
visit_VARCHAR
,visit_CHAR
,visit_VARGRAPHIC
, andvisit_GRAPHIC
. CLOB types do not require a length specified, however so we could actually adjust the code for them to let the database pick the default in that case.Affected code is at https://github.com/IBM/sqlalchemy-ibmi/blob/master/sqlalchemy_ibmi/base.py#L292-L322