proxy requires connection with joins

Issue #83 resolved
Former user created an issue

join(tablea, tableb) using a ProxyEngine for tablea and tableb

worked well. I updated to trunk 1064 and:

Traceback (most recent call last): File "./test.py", line 106, in ? j = join(tablea, tableb) File "...sqlalchemy/lib/sqlalchemy/sql.py", line 42, in join return Join(left, right, onclause, **kwargs) File "...sqlalchemy/lib/sqlalchemy/sql.py", line 826, in init self.onclause = self._match_primaries(left, right) File "...sqlalchemy/lib/sqlalchemy/sql.py", line 843, in _match_primaries if fk.references(primary): File "...sqlalchemy/lib/sqlalchemy/schema.py", line 392, in references return table._get_col_by_original(self.column, False) is not None File "...sqlalchemy/lib/sqlalchemy/sql.py", line 562, in _get_col_by_original return self.original_columnscolumn.original File "...sqlalchemy/lib/sqlalchemy/sql.py", line 1014, in _orig_columns oid = self.oid_column File "...sqlalchemy/lib/sqlalchemy/sql.py", line 1001, in _oid_col if self.engine.oid_column_name() is not None: File "...sqlalchemy/lib/sqlalchemy/ext/proxy.py", line 35, in oid_column_name e= self.get_engine() File "...sqlalchemy/lib/sqlalchemy/ext/proxy.py", line 113, in get_engine raise AttributeError('No connection established') AttributeError: No connection established

I imagine it has to do with the recent refactory and removal of ProxyTableImpl and ProxyColumnImpl

Comments (2)

  1. Former user Account Deleted

    actually the problem can be quick fixed simply putting

    def oid_column_name(self): return None

    in BaseProxyEngine, ProxyEngine or a custom subclass of ProxyEngine.

  2. Mike Bayer repo owner

    yes that fixes it, but it is a failure to not have the oid feature present at all, not necessarily because oid cols are so important, but just the principle that we want to be able to have as much engine-specific behavior maintained as possible, within the model that things can be constructed in a db-agnostic way, but upon compilation should pull in all the db-specific behavior they can.

    anyway, made a slight adjustment to FromClause and Join that restores their "late-binding" behavior with regards to oid, changeset:1066

  3. Log in to comment