Bare with me. I'm some what new to SQL Alchemy so feel free to let me know if there is any info I can provide.
I was wondering how I could type cast a jsonb (which should have a UUID init) to a UUID or vice versa in a .join?
I have the following code:
.join(
CandidateActivity,
db.and_(
User.id == CandidateActivity.candidate_id,
CandidateActivity.type.in_(['question_answered', 'question_viewed', 'feedback_clicked', 'feedback_inbound']),
db.or_(CandidateActivity.data['track']['id'] == UserTrack.track_id, CandidateActivity.data['track']['track_id'] == UserTrack.track_id)
),
isouter=True
) \
with the db.or_ causing the following error:
"sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) operator does not exist: jsonb = uuid",
"LINE 2: ...(((candidate_activities.data -> 'track') -> 'id') = user_tra...",
" ^",
"HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.",
I've tried casting one or the other to a string with no luck and I don't see anything in google that specifies the solution to this problem that I have found.
Thank you in advance for any help.