github-actions[bot] opened a new pull request, #75194: URL: https://github.com/apache/airflow/pull/75194
* Fix log template sync failing when a custom SQL Alchemy schema is configured When sql_alchemy_schema is set, reflect_tables() derived the schema to reflect a mapped class's table under by splitting its bare __tablename__ on a dot, which discards the schema entirely for classes like LogTemplate whose table name has no dot. synchronize_log_template() then looked up the reflected table by that same bare name, which also does not match how SQLAlchemy keys schema-qualified tables in the reflected metadata. Together these left the log_template table unrecognized under a custom schema, causing triggering a Dag to fail with a TypeError. Derive the schema from the mapped class's own configured table instead of parsing its name, and look the reflected table up by its schema -qualified key. * Add newsfragment for log template custom schema fix * Remove newsfragment for log template custom schema fix Not needed for this change per review feedback. * Use inspect().local_table instead of getattr for the mapped class's schema getattr(tbl, "__table__") worked around __table__ not being declared on MappedClassProtocol, but SQLAlchemy's inspect() already exposes the same table through a properly typed Mapper.local_table, so the getattr and its explanatory comment are no longer needed. (cherry picked from commit 6aee277d4a9bbf518d9c6359f0d0ab468b4da898) Co-authored-by: Aaryan Mahajan <[email protected]> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
