Hi, I'm not sure this is supported or intended to work, but I'm trying to use a value inside a JSONB field in a relationship.
class Department(DeclarativeBase): __tablename__ = "department" department_id = Column(Integer, autoincrement=True, primary_key=True) class Project(DeclarativeBase): __tablename__ = "project" project_id = Column(Integer, autoincrement=True, primary_key=True) meta = Column(MutableDict.as_mutable(JSONB), nullable=False, default={}) department = relation( "Department", viewonly=True, primaryjoin="foreign(Department.department_id) == Project.meta['department_id'].astext.cast(Numeric)", ) When I try to access project.department I get the following error: ProgrammingError: (psycopg2.errors.AmbiguousFunction) operator is not unique: unknown ->> unknown LINE 3: ...vite": true, "send_project_record_invite": true}' ->> 'depar... ^ HINT: Could not choose a best candidate operator. You might need to add explicit type casts. Is there a way to do this wth relationship? Fair enough if not supported, I can work around it with hybrid properties or column properties, was just trying a different way. Thanks for a great library, João -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAJGrhWZ8sZ%2BGU0y7K9RSu03ie6Y-1Y-S3%3DwgYQ_meLG%3DK4qjxA%40mail.gmail.com.