I have problem with simple variable binding in my code:
conn_str = (f"oracle+cx_oracle://{self.params.user}:{urllib.parse.quote_plus(self.params.password)}"
f"@{self.params.host}:{self.params.port}/?service_name={self.params.service}")
self.engine = create_engine(conn_str)
with self.engine.connect() as conn:
s = text("""TRUNCATE TABLE :t1""")
conn.execute(s, t1=table_name)
Error:
sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-01036: illegal variable name/number
[SQL: TRUNCATE TABLE :t1]
[parameters: {'t1': 'hss_prod'}]
(Background on this error at: https://sqlalche.me/e/14/4xp6)
I've revieved documentation:
and simmilar issues:
- https://github.com/oracle/python-cx_Oracle/issues/433
- DatabaseError: ORA-01036: illegal variable name/number
and can't get my head around it.