So I was wondering if anyone could help me.
I currently have some class
class Sha1(ColumnClause):
pass
@compiles(Sha1)
def compile_sha1(element, compiler, **kw):
return 'PASSWORD("{}")'.format(element.name)
And when I use SQLAlchemy orm to insert a column I can pass the attribute as Sha1(value) and let it do its thing. However for testing purposes we load up our models into a database something like
insert = model.__table__.insert(values)
session.execute(insert)
Is there a way, in sqlalchemy, to override the way a specific model's sql is generated such that it will change the generated output from
insert into model (uuid, password) values (:uuid, :password)
to use my Sha1 class like
insert into model (uuid, password) values (:uuid, PASSWORD(:password))
Any ideas?