python-gino / gino

GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
https://python-gino.org/
Other
2.67k stars 150 forks source link

Passing func type argument to Model.create does not work as expect #736

Open roycefanproxy opened 3 years ago

roycefanproxy commented 3 years ago

Description

Model.create() does not seem to work with sqlalchemy.func object.

What I Did

Currently I make use of crypt() and gen_salt() from pgcrypto extension to generate password hash. What I want to do is to create a user record as follow:

new_user = await User.create(email="example@example.com", password=func.crypt(pass_val, func.gen_salt('bf', 7)), **data)

Is my understanding of Model.create usage wrong or it's a bug, or a feature doesn't support yet?

fantix commented 3 years ago

Right, this was not considered yet - I made it partially work a few days ago, but I'll need a few more weekends to make it hit production.