that won't work as you expect.

You're applying the python character replacements to the arguments, and 
then emitting that in sql.  You'll end up with the same 
InstrumentedAttribute issue, because you're trying to operate on the Python 
column instance in the orm defintion.

the string returned by the custom compiler should be a sql function, 
something like:

    """REPLACE(REPLACE(REPLACE(%s, CHR(9), ''), CHR(10), ''), CHR(13), 
'')""""  % compiler.process(args[0])

That would create sql from your example that reads:

    SELECT REPLACE(REPLACE(REPLACE(<whatever the dynamic table/column alias 
is>, CHR(9), ''), CHR(10), ''), CHR(13), '') LIMIT 1;

If you just want to insert data, you could just use a python function that 
does that string cleanup.

SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See for a full description.
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to