Try to use triple-quoted strings. It is a good way to have readable multi-line strings. I don't have an Oracle DB to test here, but I am guessing the lack of white space is causing you problems.
Print your SQL statement and you will see how it actually looks with the backslashes removed:
sql=("\
SELECT a.first, c.second, c.third, c.fourth FROM FIRST_DB.first_table a,\
FIRST_DB.second_table b,\
OTHER_DB.third_table c\
\
WHERE\
a.identifier='XXXX' and\
a.this_row = b.that_row and\
b.this_row = c.that_row;\
")
>>> print sql
SELECT a.first, c.second, c.third, c.fourth FROM FIRST_DB.first_table a,FIRST_DB
.second_table b,OTHER_DB.third_table cWHEREa.identifier='XXXX' anda.this_row = b
.that_row andb.this_row = c.that_row;