neutron/neutron/objects
Mike Bayer e98a268de4 Propose replacement of ORM from_self()
The from_self() method in SQLAlchemy is currently
being considered for removal from the library,
with a deprecation phase throughout 1.4 and then
removal by SQLAlchemy 2.0.

The from_self() method takes an ORM query object,
turns it into a subquery, then returns a new query
object that will SELECT from that subquery, while transparently
altering subsequent criteria added to the query to
be stated in terms of the subquery.   The current
design direction of SQLAlchemy hopes to
de-emphasize the "transparently altering criteria"
part of the above use case, and to move users towards a
more explicit and model of usage where a subquery should
be created and used explicitly using the aliased()
construct, which is now very mature and can be used in ways
that were not available when from_self() was first introduced.

On the SQLAlchemy side, from_self() has proven to be one
of the most difficult features to maintain and test
as it can easily lead to extremely complicated scenarios, and
while I am also experimenting with some alternatives that
may still retain some of the "automatic translation" features,
those features are still proving to add similar internal
complexity which is having me lean towards the original
plan of removing open-ended "entity translation" features
like that of from_self() at least through the start
of the 2.0 series.

A code search for all of Openstack shows that the
two files modified here are the only usages of the
from_self() method throughout all of searchable Openstack
code.  This speaks to the general obscurity of this method,
although neutron's Subnet code is actually using this
method as intended.    The new approach necessarily changes
some of the method signatures here so that the explicit
"subquery" entity can be passed; code searches again
show that these methods are not being called anywhere
outside, so the query_filter_service_subnets method
becomes the private _query_entity_service_subnets method.

References: https://github.com/sqlalchemy/sqlalchemy/issues/5368

Closes-Bug: #2004263

Change-Id: Icec998873221ac8e6a1566a157b2044c1f6cd7f3
2023-02-01 14:30:37 +00:00
..
db [sqlalchemy-20] Add the needed DB context decorators in ``db.api`` 2022-05-16 07:14:37 +00:00
extensions use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
logapi use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
plugins Randomize segmentation ID assignation 2021-03-24 13:56:09 +00:00
port Add validation to ip_version field 2022-09-02 16:29:13 +00:00
qos Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
README.rst Objects: Add README for neutron/objects directory tree 2016-10-07 15:12:20 +00:00
__init__.py Bump pylint version to support python 3.8 2020-08-06 16:00:30 +02:00
address_group.py Replace "target_tenant" with "target_project" in RBAC OVOs and models 2021-12-03 10:48:57 +00:00
address_scope.py Add the corresponding DB context to all SQL transactions 2022-04-08 09:09:54 +00:00
agent.py Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
auto_allocate.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
base.py Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
conntrack_helper.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
flavor.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
floatingip.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
ipam.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
l3_hamode.py Add the corresponding DB context to all SQL transactions 2022-04-08 09:09:54 +00:00
l3agent.py Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
local_ip.py Add Local IP Extension and DB 2021-11-11 10:08:23 +03:00
metering.py Add source_ip_prefix and destination_ip_prefix to metering label rules 2020-09-29 09:06:03 -03:00
ndp_proxy.py [Server Side] L3 router support ndp proxy 2022-02-03 10:07:46 +08:00
network.py Replace "target_tenant" with "target_project" in RBAC OVOs and models 2021-12-03 10:48:57 +00:00
network_segment_range.py Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
port_forwarding.py Merge "Add the corresponding DB context to all SQL transactions" 2022-04-08 13:08:32 +00:00
ports.py [OVN] Add vnic_type and binding profile capabilities to LSP info 2023-01-18 05:01:21 +01:00
provisioning_blocks.py [OVO] Switch to use own registry 2017-11-22 17:44:22 +01:00
quota.py Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
rbac.py Add the corresponding DB context to all SQL transactions 2022-04-08 09:09:54 +00:00
rbac_db.py Fix some pylint indentation warnings 2022-08-09 15:10:01 -04:00
router.py Always create a "router_extra_attributes" register per router 2022-11-18 08:51:43 +00:00
securitygroup.py Add the corresponding DB context to all SQL transactions 2022-04-08 09:09:54 +00:00
servicetype.py use objects common_types from neutron-lib 2019-11-26 15:34:18 +01:00
stdattrs.py Use neutron-lib standard_attr 2021-09-15 09:19:26 +00:00
subnet.py Propose replacement of ORM from_self() 2023-02-01 14:30:37 +00:00
subnetpool.py Add the corresponding DB context to all SQL transactions 2022-04-08 09:09:54 +00:00
tag.py Use neutron-lib standard_attr 2021-09-15 09:19:26 +00:00
trunk.py [OVN] Execute OVN migration transactions independently 2021-11-11 07:11:47 +00:00

README.rst

Neutron Objects

Directory

This directory is designed to contain all modules which have objects definitions shipped with core Neutron. The files and directories located inside of this directory should follow the guidelines below.

Structure

The Neutron objects tree should have the following structure:

  • The expected directory structure is flat, except for the ML2 plugins. All ML2 plugin objects should fall under the plugins subdirectory (i.e. plugins/ml2/gre_allocation).
  • Module names should use singular forms for nouns (network.py, not networks.py).