I'm very new to fastapi and python altogether. I'm using pgcrypto module to encrypt the personal info of the customers. My raw query is select pgp_sym_decrypt(cast(email as bytea), 'secret_key') as email from customers and the query works fine. How to produce something similar in SqlAlchemy? I've tried something like this from sqlalchemy import select, func, cast, LargeBinary from sqlalchemy.dialects.postgresql import BYTEA customer = select(func.pgp_sym_decrypt(cast(Customer.c.email, 'bytea'), 'secret_key')) Also tried customer = select(func.pgp_sym_decrypt(cast(Customer.c.email, BYTEA), 'secret_key')) Also tried customer = select(func.pgp_sym_decrypt(cast(Customer.c.email, LargeBinary), 'secret_key')) But no luck anywhere. So, how to solve this problem? Any help would be appreciated. Thank you so much in advance. Continue reading...