Python cx_Oracle: binding not working for join statement

sql_str = "SELECT table_1.id, table_1.name_id FROM table_1 JOIN table_2 ON table_1.consolidate_id  = table_2.id where table_1.consolidate_id = :cons_id  AND table_2.name_tag = :ntag"

I am running where consolidate_id=‘1’ and name_tag=’ALEX’

ntag = 'ALEX'
cons_id = '1'
value_dict = {"cons_id": cons_id, "ntag": ntag }
result = cursor.execute(sql_str, value_dict).fetchall()
print(len(result))

What happens? We are not looking over your shoulder.

My guess would be that there is no record in table_2 which has id = 1 and name_tag = "ALEX". Or maybe even in table_1 there may be no record for consolidate_id = 1.

Did you check?

This looks correct to me. So if you get a result you didn’t expect, I guess your database content is different from what you expect.

You might get a better answer in the cx_Oracle mailing list: https://sourceforge.net/projects/cx-oracle/lists/cx-oracle-users