1. Michael Bayer
  2. sqlalchemy
  3. Issues


Issue #918 resolved

positional column targeting

Michael Bayer
repo owner created an issue

this would mostly help with things like func.foo(type_=Date).execute(), where theres not very good column name targeting and you cant even get labels in there. defect because the above is impossible to do right now for a DB like oracle. patch which doesnt pass all tests yet attached.

Comments (3)

  1. Michael Bayer reporter

    function names just needed a label which has been added in a recent release. positional has issues, including incompatibility with the current style of text() constructs, and the fact that we "unique" column names in SELECT constructs implying we are already very name-based (compiler needs more left turns to do unique+positional at the same time). we could also never be 100% sure about text constructs which may have multiple column expressions present.

  2. Michael Bayer reporter
    • The SQL compiler now generates the mapping of expected columns such that they are matched to the received result set positionally, rather than by name. Originally, this was seen as a way to handle cases where we had columns returned with difficult-to-predict names, though in modern use that issue has been overcome by anonymous labeling. In this version, the approach basically reduces function call count per-result by a few dozen calls, or more for larger sets of result columns. The approach still degrades into a modern version of the old approach if textual elements modify the result map, or if any discrepancy in size exists between the compiled set of columns versus what was received, so there's no issue for partially or fully textual compilation scenarios where these lists might not line up. fixes #918
    • callcounts still need to be adjusted down for this so zoomark tests won't pass at the moment

    → <<cset b3d3795de0d4>>

  3. Michael Bayer reporter
    • Fixed regression where :meth:.ResultProxy.keys would return un-adjusted internal symbol names for "anonymous" labels, which are the "foo_1" types of labels we see generated for SQL functions without labels and similar. This was a side effect of the performance enhancements implemented as part of references #918. fixes #3483

    → <<cset d7ceb63c94e4>>

  4. Log in to comment