← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2020050] [NEW] [sqlalchemy-20] Use a ``TextClause`` object for the empty strings in the DB model definitions

 

Public bug reported:

The alembic comparator between the DB models and the loaded metadata in the database, cannot compare an empty string clause with a ``TextClause``. For example:
[( 'modify_default',
      None,
      'ml2_port_bindings',
      'vif_details',
      { 'existing_comment': None,
        'existing_nullable': False,
        'existing_type': VARCHAR(length=4095)},
      DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7fbadc92ada0>, for_update=False),
      DefaultClause('', for_update=False))],

This is happening because in the DB model definitions we are using an
empty string. For example, from the error presented, the "vif_details"
column definition in the "ml2_port_bindings" table is [1]. The
"server_default" parameter should be a ``TextClause`` object instead.

[1]https://github.com/openstack/neutron/blob/a26e957d346c79ce96680b437460c9a9c4b80447/neutron/plugins/ml2/models.py#L50-L51

** Affects: neutron
     Importance: Undecided
     Assignee: Rodolfo Alonso (rodolfo-alonso-hernandez)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Rodolfo Alonso (rodolfo-alonso-hernandez)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2020050

Title:
  [sqlalchemy-20] Use a ``TextClause`` object for the empty strings in
  the DB model definitions

Status in neutron:
  New

Bug description:
  The alembic comparator between the DB models and the loaded metadata in the database, cannot compare an empty string clause with a ``TextClause``. For example:
  [( 'modify_default',
        None,
        'ml2_port_bindings',
        'vif_details',
        { 'existing_comment': None,
          'existing_nullable': False,
          'existing_type': VARCHAR(length=4095)},
        DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7fbadc92ada0>, for_update=False),
        DefaultClause('', for_update=False))],

  This is happening because in the DB model definitions we are using an
  empty string. For example, from the error presented, the "vif_details"
  column definition in the "ml2_port_bindings" table is [1]. The
  "server_default" parameter should be a ``TextClause`` object instead.

  [1]https://github.com/openstack/neutron/blob/a26e957d346c79ce96680b437460c9a9c4b80447/neutron/plugins/ml2/models.py#L50-L51

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2020050/+subscriptions



Follow ups