Hi,

I'm trying to use a custom BYTEA-based type on PostgreSQL (9.2) on 
SQLAlchemy 1.0.9., e.g.

class MySpecialBytea(types.TypeDecorator):
    impl = BYTEA

    def process_result_value(self, value, dialect):
        print "Processing result value in Python"
        return py_side_process(value) if value is not None else value
        
    def column_expression(self, col):
        return func.sql_side_process(col)

    # process_bind_param and bind_expression also defined


However, I have noticed that I can't seem to have both of them apply to my 
entries, as only the column_expression processing seems to apply. If, 
however, I comment that method out, I can readily see the 
process_result_value executing while retrieving the relevant column. 
I am not sure whether this is intended or a bug, but since the counterparts 
process_bind_param and bind_expression seem work together in my case, I'm 
inclined to suspect the latter. If it is not, though, is there some other 
way to apply both SQL- and Python-side processing simultaneously to my 
results? I'm currently working around it by offloading the Python 
processing into my application code, but it would make more sense and be 
neater to keep it on the SQLAlchemy layer.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to