I'm trying to build a custom type [1] to manage the bcrypt hashes [2].
---
from bcrypt_wrap import password
from sqlalchemy import types
class Bcrypt(types.TypeDecorator):
Stores a bcrypt hash of a password.
impl = types.String #(60)
hasher = password.Password()
def
On Dec 21, 2008, at 6:53 AM, Kless wrote:
I'm trying to build a custom type [1] to manage the bcrypt hashes [2].
---
from bcrypt_wrap import password
from sqlalchemy import types
class Bcrypt(types.TypeDecorator):
Stores a bcrypt hash of a password.
impl = types.String
Thank you for detailed answer.
Here are any thoughts:
1) The before_insert was being omitted while I was inserting records
using an insert statement --that's logical because it was bypassing
the ORM--.
2) It's necessary to use *session.commit()* after of each record
because else it will have
oh, yeah for that recipe you'd have to use a flag on the mapper()
called batch=False.But don't use that, its inefficient.
So you can also create your type to detect a special value from the
mapper extension:
def before_insert(self, ):
instance.password = (instance.password,
I occasionally have a query fail with 'Lost connection to MySQL server
during query' which gets converted into a
sqlalchemy.exceptions.OperationalError. I have not been able to figure
out why it happens, but the server should always be available.
I would like to tell sqlalchemy that if a query
On Dec 21, 2008, at 11:24 PM, Bobby Impollonia wrote:
I occasionally have a query fail with 'Lost connection to MySQL server
during query' which gets converted into a
sqlalchemy.exceptions.OperationalError. I have not been able to figure
out why it happens, but the server should always be
This code isn't using transactions so retrying a failed query should
be as simple as creating a new connection to replace the failed one
and executing the query again.
Still, I would much prefer to figure out the real cause, as you say. I
had sort of given up on that because after a little while