开发者

What is the `connection` parameter of MapperExtension in sqlalchemy?

开发者 https://www.devze.com 2023-01-14 17:41 出处:网络
The class MapperExtension has some methods, and before_insert, before_update, ... all have a parameter connection.

The class MapperExtension has some methods, and before_insert, before_update, ... all have a parameter connection.

def before_insert(self, mapper, co开发者_JAVA百科nnection, instance):

I've read the documents of MapperExtension, but found nothing about this connection. What is it? And how to use it?


It's an instance of Connection class. Recent versions of SQLAlchemy distribution have examples directory, see examples/nested_sets/nested_sets.py to get an idea on how to use it in mapper extension.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号