Error in sql query Interbase / Firebird with python

1

I have an error in an sql query that I make to the firebird / interbase database with python. This one throws me an error:

     for rec in cur.fetchall():
kinterbasdb.ProgrammingError: (-802, 'fetch: \n  arithmetic exception, numeric o
verflow, or string truncation\n  Cannot transliterate character between characte
r sets')

I understand that it is a problem of characters, because the error is when extracting the data SELECT ciudad.descripcion FROM clientes , this contains for example Cordoba V. Allende . I think the error is in the . of the data, since when extracting the query from python cursor.execute(QUERY) , two types of data are being executed, one text string and the other special character. I have used several functions, but I have not had satisfactory results, for example:

CAST(ciudad.descripcion AS varchar(40))

or

CAST(ciudad.descripcion AS varchar(40) character set UTF-8)

I get this error:

    cur.execute(SELECT)
kinterbasdb.ProgrammingError: (-104, 'isc_dsql_prepare: \n  Dynamic SQL Error\n
 SQL error code = -104\n  Token unknown - line 1, column 80\n  -')

Greetings and thanks in advance!

    
asked by Nahuel Jakobson 20.03.2016 в 18:32
source

1 answer

1

The mistake was simpler than I thought:

con = kinterbasdb.connect(dsn=rute,user='user', password='password', dialect=3,charset='DOS437')

What caused the error was the dialect=3 (not so the 1) and the ASCII code.

    
answered by 01.04.2016 / 14:22
source