standardize auto table aliasing/column labeling, bind params

Issue #97 resolved
Mike Bayer repo owner created an issue

we are now building up a bunch of code that is aliasing tables and labeling columns. the old "concatentation" methodologies dont work as most DB's have all kinds of restrictions on identifier lengths. right now we use random hex strings. so heres the ticket:

  • the algorithm should be changed to use an HMAC scheme that will return the same results each time for the same given name, to make it easier to write external SQL code, to enable unit tests, and to make echo'ed output easier to read.
  • all names should be limited to 30 characters (configurable. compiler-dependent ?)
  • the names should have only four hex characters at the end of the string, instead of clumps of hex characters as occurs now when you have a table alias combined into a column label.
  • groups of columns that are linked to the same table should preferably have the same four-digit grouping (though this may break their uniqueness if names are truncated)
  • bind parameters still have hardcoded "table_column" strings being used as identifiers, particularly in the mapper code where one piece of code sets up a bind dictionary and another reads/populates it. these should be abstracted away as well and probably derive from the column._label in all cases.
  • the "label" accessor on ColumnClause should be marked non-private

Comments (3)

  1. Mike Bayer reporter
    • marked as

    this is not really so critical right now...aliasing code has been working quite smoothly. the solution to end-user queries should be more along the lines to better hooks for substituting the generated names, rather than exposing those generated names. hibernate has some interesting ideas in their "literal" SQL query objects regarding this.

  2. Log in to comment