diff --git a/README.md b/README.md index bb8a2a0f..049761fb 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,20 @@ With trace, we see how ``dill`` stored the lambda (``F1``) by first storing (which is used to handle code objects), then we handle the reference to the global dict (``D2``). A ``#`` marks when the object is actually stored. +Custom pickling + +```python +import dill +from sqlalchemy import create_engine +from sqlalchemy.engine import Engine + +@dill.register(Engine) +def save_sqlalchemy_engine(pickler, obj): + pickler._byref = getattr(pickler, '_byref', False) + pickler._recurse = getattr(pickler, '_recurse', False) + pickler.save_reduce(create_engine, (obj.url,), obj=obj) +``` + More Information ----------------