[Python] String data, right truncation while using fast executemany with pyodbc

Discussão em 'Python' iniciado por Stack, Março 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am struggling with


    pyodbc.ProgrammingError: ('String data, right truncation: length 636 buffer 510', 'HY000')
    ​

    while using executeMany() with __crsr.fast_executemany = True. When I remove this line everything works fine.

    I am using pyodbc (4.0.30) and MSSQL with ODBC Driver 17 for SQL Server.

    My database table looks like 4 columns and each of them is varchar(255).

    I already to add this line: crsr.setinputsizes([(pyodbc.SQL_WVARCHAR, 50, 0)]) and add UseFMTOnly=yes to connection string but it didn't work.

    Could you guys help me, please? I am already tired of that.

    Continue reading...

Compartilhe esta Página