diff --git a/neutron/common/_constants.py b/neutron/common/_constants.py index e43d1c74c88..40745ecc86a 100644 --- a/neutron/common/_constants.py +++ b/neutron/common/_constants.py @@ -14,7 +14,6 @@ # limitations under the License. from neutron_lib import constants -from sqlalchemy.sql import elements # NOTE(boden): This module is common constants for neutron only. # Any constants used outside of neutron should go into neutron-lib. @@ -93,6 +92,3 @@ METADATA_V6_CIDR = constants.METADATA_V6_IP + '/128' # TODO(haleyb): move this constant to neutron_lib.constants IPV4_MIN_MTU = 68 - -# TODO(ralonsoh): move to neutron-lib.db.contants -SQL_EMPTY_STRING = elements.TextClause("''") diff --git a/neutron/db/models/dns.py b/neutron/db/models/dns.py index 1bc95835deb..651a04275ec 100644 --- a/neutron/db/models/dns.py +++ b/neutron/db/models/dns.py @@ -16,7 +16,6 @@ import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy import sql -from neutron.common import _constants as n_const from neutron.db.models import l3 as l3_models from neutron.db import models_v2 @@ -86,7 +85,7 @@ class PortDNS(model_base.BASEV2): dns_name = sa.Column(sa.String(255), nullable=False) dns_domain = sa.Column(sa.String(constants.FQDN_FIELD_SIZE), nullable=False, - server_default=n_const.SQL_EMPTY_STRING) + server_default='') # Add a relationship to the Port model in order to instruct # SQLAlchemy to eagerly load this association port = orm.relationship(models_v2.Port, diff --git a/neutron/db/models_v2.py b/neutron/db/models_v2.py index 11a9b76519c..789db0680c3 100644 --- a/neutron/db/models_v2.py +++ b/neutron/db/models_v2.py @@ -25,7 +25,6 @@ import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy import sql -from neutron.common import _constants as n_const from neutron.db.network_dhcp_agent_binding import models as ndab_model from neutron.db import rbac_db_models @@ -297,8 +296,7 @@ class SubnetPool(standard_attr.HasStandardAttributes, model_base.BASEV2, is_default = sa.Column(sa.Boolean, nullable=False, server_default=sql.false()) default_quota = sa.Column(sa.Integer, nullable=True) - hash = sa.Column(sa.String(36), nullable=False, - server_default=n_const.SQL_EMPTY_STRING) + hash = sa.Column(sa.String(36), nullable=False, server_default='') address_scope_id = sa.Column(sa.String(36), nullable=True, index=True) prefixes = orm.relationship(SubnetPoolPrefix, backref='subnetpools', diff --git a/neutron/plugins/ml2/models.py b/neutron/plugins/ml2/models.py index 78e6c05efa3..6061eaa1bd6 100644 --- a/neutron/plugins/ml2/models.py +++ b/neutron/plugins/ml2/models.py @@ -19,7 +19,6 @@ from neutron_lib.db import model_base import sqlalchemy as sa from sqlalchemy import orm -from neutron.common import _constants as n_const from neutron.db.models import segment as segment_models from neutron.db import models_v2 @@ -46,10 +45,10 @@ class PortBinding(model_base.BASEV2): default=portbindings.VNIC_NORMAL, server_default=portbindings.VNIC_NORMAL) profile = sa.Column(sa.String(BINDING_PROFILE_LEN), nullable=False, - default='', server_default=n_const.SQL_EMPTY_STRING) + default='', server_default='') vif_type = sa.Column(sa.String(64), nullable=False) vif_details = sa.Column(sa.String(4095), nullable=False, default='', - server_default=n_const.SQL_EMPTY_STRING) + server_default='') status = sa.Column(sa.String(16), nullable=False, default=constants.ACTIVE, server_default=constants.ACTIVE) @@ -116,12 +115,12 @@ class DistributedPortBinding(model_base.BASEV2): router_id = sa.Column(sa.String(36), nullable=True) vif_type = sa.Column(sa.String(64), nullable=False) vif_details = sa.Column(sa.String(4095), nullable=False, default='', - server_default=n_const.SQL_EMPTY_STRING) + server_default='') vnic_type = sa.Column(sa.String(64), nullable=False, default=portbindings.VNIC_NORMAL, server_default=portbindings.VNIC_NORMAL) profile = sa.Column(sa.String(BINDING_PROFILE_LEN), nullable=False, - default='', server_default=n_const.SQL_EMPTY_STRING) + default='', server_default='') status = sa.Column(sa.String(16), nullable=False) # Add a relationship to the Port model in order to instruct SQLAlchemy to