arvindmunna opened a new issue, #47300:
URL: https://github.com/apache/airflow/issues/47300
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
2.10.4
### What happened?
What happened:
When using a custom schema for the Airflow metadata database, the
log_template table is not automatically seeded with default data. As a result,
when triggering a DAG, Airflow attempts to set the log_template_id using the
following code:
python
Copy
Edit
run.log_template_id =
int(session.scalar(select(func.max(LogTemplate.__table__.c.id))))
Because the custom schema’s log_template table is empty, the query returns
None, and attempting to convert None to an integer raises a TypeError:
php
Copy
Edit
TypeError: int() argument must be a string, a bytes-like object or a real
number, not 'NoneType'
In contrast, when using the default public schema, the table is seeded with
default data, and this error does not occur.
### What you think should happen instead?
The log_template table should be seeded with default data even when using a
custom schema—just as it is for the public schema. Alternatively, the code
should handle an empty log_template table gracefully (for example, by
defaulting to 0 when no rows exist).
### How to reproduce
Create a custom schema in your Airflow metadata database (e.g.,
my_custom_schema).
Update the Airflow configuration (in airflow.cfg or via the environment
variable **sql_alchemy_schema = ${SQL_ALCHEMY_SCHEMA}**
to use your custom schema.
- Start Airflow.
- Run db migrate ( this will add permisssions and tables inside the schema)
- Trigger a DAG via the UI or API.
- Observe that the DAG trigger fails with the following error:
- TypeError: int() argument must be a string, a bytes-like object or a real
number, not 'NoneType'
because the log_template table in the custom schema is empty.

<img width="748" alt="Image"
src="https://github.com/user-attachments/assets/599875fb-3a12-49a5-91a3-915e13983788"
/>
### Operating System
docker container- aws ecs
### Versions of Apache Airflow Providers
2.10.4 ( docker image)
### Deployment
Other Docker-based deployment
### Deployment details
we used the offciail docker image from airflow and on top of that we run few
commands and deploy it in aws ecs service
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]