@taake: Also so grundsätzlich gibt es doch Beispiele wie Abfragen über das ORM mit einem `Session`-Objekt funktionieren. Und aus den Operatoren ``==``, ``!=``, ``<``, ``>`` und so weiter könnte man auch ableiten das ``+`` funktionieren könnte. Und das tut es auch:
Code: Alles auswählen
In [37]: print session.query(Accounting).filter((Accounting.vorname + ' ' + Acco
...: unting.nachname).like('%Something%'))
SELECT accounting.id AS accounting_id, accounting.vorname AS accounting_vorname, accounting.nachname AS accounting_nachname
FROM accounting
WHERE (concat(concat(accounting.vorname, %s), accounting.nachname)) LIKE %s
Ansonsten gibt's im `sql.functions`-Untermodul auch eine `concat()`-Funktion:
Code: Alles auswählen
In [42]: print session.query(Accounting).filter(sa.sql.functions.concat(Accounti
...: ng.vorname, ' ', Accounting.nachname).like('%Something%'))
SELECT accounting.id AS accounting_id, accounting.vorname AS accounting_vorname, accounting.nachname AS accounting_nachname
FROM accounting
WHERE concat(accounting.vorname, %s, accounting.nachname) LIKE %s
Falls es Funktionen nicht gibt, kann man sich die ”generisch” mit `sql.func` erstellen. Ich würde aber in diesem Fall bei ``+`` bleiben, denn `concat()` ist nicht SQL-Standard und ``+`` wird passend zur Datenbank übersetzt. Standard wäre der ``||``-Operator.