Bartosz Marcinkowski
Bartosz Marcinkowski

Reputation: 6861

SQLAlchemy - using column in LIKE

Is it possible to do this

select x.name, y.name, y.info
from tag x
join tag y
on y.info like '%#' || x.name || '#%';

with SQLAlchemy? I found examples using LIKE, but only with literals (from the SQL point of view).

Upvotes: 0

Views: 84

Answers (1)

uralbash
uralbash

Reputation: 3608

session.query(x).join(y).filter("y.info LIKE '%#'||x.name||'#%'").all()

Upvotes: 2

Related Questions