Foreign key specification outlaws legal SQL identifier character "$"

Issue #667 resolved
Former user created an issue

When I attempt to create a relation() to a table in our legacy database, I receive the error:

ArgumentError: Error determining primary and/or secondary join for
relationship 'PersonRow.roles (RoleRow)'. If the underlying error cannot be
corrected, you should specify the 'primaryjoin' (and 'secondaryjoin', if
there is an association table present) keyword arguments to the relation()
function (or for backrefs, by specifying the backref using the backref()
function with keyword arguments) to explicitly specify the join conditions.
Nested error is "Invalid foreign key column specification: people.person$"

The foreign-key code in schema.py seems to compare foreign key specifications against a regular expression that does not allow the character "$" in database identifiers, despite the fact that they are allowed in PostgreSQL. In my case, our old legacy database uses "$" characters in opaque primary keys to visually distinguish them from normal object data. So the unique identifier for a row in the "people" table is its "person$".

Comments (1)

  1. Log in to comment