swh.core.db.common module#
- swh.core.db.common.apply_options(cursor, options)[source]#
- Applies the given postgresql client options to the given cursor. - Returns a dictionary with the old values if they changed. 
- swh.core.db.common.db_transaction(**client_options)[source]#
- decorator to execute Backend methods within DB transactions - The decorated method must accept a - curand- dbkeyword argument- Client options are passed as - setoptions to the postgresql server. If available, decorated- self.query_optionscan be defined as a dict which keys are (decorated) method names and values are dicts. These later dicts are merged with the given- client_options. So it’s possible to define default client_options as decorator arguments and overload them from e.g. a configuration file (e.g. making is the- self.query_optionsattribute filled from a config file).
- swh.core.db.common.db_transaction_generator(**client_options)[source]#
- decorator to execute Backend methods within DB transactions, while returning a generator - The decorated method must accept a - curand- dbkeyword argument- Client options are passed as - setoptions to the postgresql server. If available, decorated- self.query_optionscan be defined as a dict which keys are (decorated) method names and values are dicts. These later dicts are merged with the given- client_options. So it’s possible to define default client_options as decorator arguments and overload them from e.g. a configuration file (e.g. making is the- self.query_optionsattribute filled from a config file).