1. Michael Bayer
  2. sqlalchemy
  3. Issues


Issue #139 resolved

composite select objects do not track columns completely

Michael Bayer
repo owner created an issue

composite selects are used mostly for UNION, UNION ALL statements, and represent a list of SELECT statements. SA, particularly the ORM, relies heavily on the abiltiy to map columns in different kinds of select's, aliases of those selects, etc. to the underlying table columns, and then back up to the columns of another select object which references "the same" columns.

a composite select is unique in that it only cares about the first select in its list. find some way to get column tracking to work for all the selects embedded in a composite select, i.e. _get_col_by_original() works for all columns that are represented somewhere in the object.

Comments (1)

  1. Michael Bayer reporter

    this is not quite as important as it seemed since it didnt solve the problem i was looking to solve, i.e. the translate_row function in mapper, which seems to be better doing its usual thing based strictly on keys. CompoundSelect now exports all columns in all selectables, which line up OK in the resulting list of columns due to their having the same keys, changeset:1244

    i think the column export on UNION is still going to be broken in some scenario, possibly if a union is created with columns that arent the same name (then youd get too many columns in the export)....when that scenario becomes apparent we'll have to reopen this.

  2. Log in to comment