test_migrations: fails when func.now()

Bug #1635915 reported by Isaku Yamahata
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-odl
Triaged
Low
Isaku Yamahata
oslo.db
Confirmed
Wishlist
Unassigned

Bug Description

The followings column, test_models_sync() fails with mysql.
It seems like it's due to mysql way of server_default.

model
    created_at = sa.Column(
        sa.DateTime().with_variant(
            sqlite.DATETIME(truncate_microseconds=True), 'sqlite'),
        server_default=sa.func.now())

alembic
        sa.Column('created_at', sa.DateTime, server_default=sa.func.now()),

msg
  [ ( 'modify_default',
      None,
      'opendaylightjournal',
      'created_at',
      { 'existing_nullable': True,
        'existing_type': DATETIME()},
      DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7f652188ce50>, for_update=False),
      DefaultClause(<sqlalchemy.sql.functions.now at 0x7f6522411050; now>, for_update=False))],

output of debugger session (with format modification)
(Pdb) diff
[[('modify_default',
    None,
   'opendaylight_maintenance',
   'lock_updated',
   {'existing_nullable': False, 'existing_type': TIMESTAMP()},
   DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7f6e02362810>, for_update=False),
   DefaultClause(<sqlalchemy.sql.functions.now at 0x7f6e03057a90; now>, for_update=False))],
   [('modify_default',
      None,
     'opendaylightjournal',
     'created_at',
     {'existing_nullable': True, 'existing_type': DATETIME()},
     DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7f6e024d1fd0>, for_update=False),
     DefaultClause(<sqlalchemy.sql.functions.now at 0x7f6e030570d0; now>, for_update=False))],
   [('modify_default',
      None,
     'opendaylightjournal',
     'last_retried',
    {'existing_nullable': True, 'existing_type': TIMESTAMP()},
      DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7f6e024600d0>, for_update=False),
      DefaultClause(<sqlalchemy.sql.functions.now at 0x7f6e03057250; now>, for_update=False))]]
(Pdb) diff[0][0][5]
DefaultClause(<sqlalchemy.sql.elements.TextClause object at 0x7f6e02362810>, for_update=False)
(Pdb) diff[0][0][5].arg
<sqlalchemy.sql.elements.TextClause object at 0x7f6e02362810>
(Pdb) diff[0][0][5].arg.text
u'CURRENT_TIMESTAMP'
(Pdb) diff[0][0][5].reflected
True
(Pdb) diff[0][0][6]
DefaultClause(<sqlalchemy.sql.functions.now at 0x7f6e03057a90; now>, for_update=False)
(Pdb) diff[0][0][6].arg
<sqlalchemy.sql.functions.now at 0x7f6e03057a90; now>
(Pdb) diff[0][0][6].reflected
False

Changed in networking-odl:
assignee: nobody → Isaku Yamahata (yamahata)
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to networking-odl (master)

Reviewed: https://review.openstack.org/390017
Committed: https://git.openstack.org/cgit/openstack/networking-odl/commit/?id=10167f5bb8b403e3377d4f12f6f23ef1a0bc24f2
Submitter: Jenkins
Branch: master

commit 10167f5bb8b403e3377d4f12f6f23ef1a0bc24f2
Author: Isaku Yamahata <email address hidden>
Date: Fri Oct 21 22:27:33 2016 -0700

    add test_migrations test

    Change-Id: Iae1ca021aa2eedef1b06fa84f58c5f407b9b5c81
    Related-bug: #1635915

Changed in oslo.db:
status: New → Confirmed
importance: Undecided → Wishlist
Changed in networking-odl:
status: New → Confirmed
importance: Medium → Low
Revision history for this message
Isaku Yamahata (yamahata) wrote :

for networking-odl, it's triaged as low.

Changed in networking-odl:
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.