Ticket #73 (closed defect: invalid)

Opened 5 years ago

Last modified 5 years ago

ext.versioned uses uppercase column names on insert to history table

Reported by: guest Owned by:
Priority: normal Milestone:
Component: extensions Version:
Keywords: Cc:

Description

When inserting to the history table of an entity, the versioned plugin uses the column names as returned from a select on the normal table:

old_values = instance.table.select(get_entity_where(instance)).execute().fetchone()
# ...
dict_values = dict(old_values.items())
connection.execute(instance.__class__.__history_table__.insert(), dict_values)

This results in column names being uppercase in the dictionary given to the insert() function. SA's behavior is to quote non-lowercase column identifiers. In Oracle, this fails, as quoted column identifiers are case-sensitive.

The solution is to use all lowercase column identifiers in the dictionary:

dict_values = dict([(tup[0].lower(), tup[1]) for tup in old_values.items()])

Thanks!

Attachments

test.py (350 bytes) - added by ged 5 years ago.

Change History

Changed 5 years ago by ged

  • status changed from new to closed
  • resolution set to invalid

As far as I know, this would break for people using non lower-case names in non Oracle database. See SA thread for follow-up.

Changed 5 years ago by ged

Changed 5 years ago by ged

attached a test script demonstrating this patch breaks other people's code

Note: See TracTickets for help on using tickets.