neutron_lib.db package

neutron_lib.db package

Submodules

neutron_lib.db.api module

neutron_lib.db.api.get_context_manager()

Transaction Context Manager accessor.

Returns:The transaction context manager.
neutron_lib.db.api.get_reader_session()

Helper to get reader session.

Returns:The reader session.
neutron_lib.db.api.get_writer_session()

Helper to get writer session.

Returns:The writer session.

neutron_lib.db.constants module

neutron_lib.db.model_base module

class neutron_lib.db.model_base.HasId

Bases: object

id mixin, add to subclasses that have an id.

id = Column(None, String(length=36), table=None, primary_key=True, nullable=False, default=ColumnDefault(<function generate_uuid>))
class neutron_lib.db.model_base.HasProject

Bases: object

Project mixin, add to subclasses that have a user.

get_tenant_id()
project_id = Column(None, String(length=255), table=None)
set_tenant_id(value)
tenant_id = <SynonymProperty at 0x7ff3344e0738; no key>
class neutron_lib.db.model_base.HasProjectNoIndex

Bases: neutron_lib.db.model_base.HasProject

Project mixin, add to subclasses that have a user.

project_id = Column(None, String(length=255), table=None)
class neutron_lib.db.model_base.HasProjectPrimaryKey

Bases: neutron_lib.db.model_base.HasProject

Project mixin, add to subclasses that have a user.

project_id = Column(None, String(length=255), table=None, primary_key=True, nullable=False)
class neutron_lib.db.model_base.HasProjectPrimaryKeyIndex

Bases: neutron_lib.db.model_base.HasProject

Project mixin, add to subclasses that have a user.

project_id = Column(None, String(length=255), table=None, primary_key=True, nullable=False)
class neutron_lib.db.model_base.HasStatusDescription

Bases: object

Status with description mixin.

status = Column(None, String(length=16), table=None, nullable=False)
status_description = Column(None, String(length=255), table=None)
class neutron_lib.db.model_base.NeutronBaseV2

Bases: neutron_lib.db.model_base._NeutronBase

neutron_lib.db.utils module

neutron_lib.db.utils.get_and_validate_sort_keys(sorts, model)

Extract sort keys from sorts and ensure they are valid for the model.

Parameters:
  • sorts – A list of (key, direction) tuples.
  • model – A sqlalchemy ORM model class.
Returns:

A list of the extracted sort keys.

Raises:

BadRequest – If a sort key attribute references another resource and cannot be used in the sort.

neutron_lib.db.utils.get_sort_dirs(sorts, page_reverse=False)

Extract sort directions from sorts, possibly reversed.

Parameters:
  • sorts – A list of (key, direction) tuples.
  • page_reverse – True if sort direction is reversed.
Returns:

The list of extracted sort directions optionally reversed.

neutron_lib.db.utils.is_retriable(exception)

Determine if the said exception is retriable.

Parameters:exception – The exception to check.
Returns:True if ‘exception’ is retriable, otherwise False.
neutron_lib.db.utils.reraise_as_retryrequest(function)

Wrap the said function with a RetryRequest upon error.

Parameters:function – The function to wrap/decorate.
Returns:The ‘function’ wrapped in a try block that will reraise any Exception’s as a RetryRequest.
Raises:RetryRequest – If the wrapped function raises retriable exception.

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.