gino icon indicating copy to clipboard operation
gino copied to clipboard

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

Open roycefanproxy opened this issue 4 years ago • 1 comments

  • GINO version: 1.0.1
  • Python version: 3.8
  • asyncpg version: 0.21
  • PostgreSQL version: 12.4

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="[email protected]", 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?

roycefanproxy avatar Oct 29 '20 08:10 roycefanproxy

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.

fantix avatar Dec 07 '20 21:12 fantix