Issue with SQLALCHEMY_TRACK_MODIFICATIONS Error when Executing SQL Query Programmatically #31896
Replies: 2 comments 1 reply
-
The Given that you've set
If these steps do not resolve the issue, consider adding additional logging around the configuration loading and session management to gain more insights into what might be causing the discrepancy. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
Hi there, I'm encountering an issue with Superset when making backend API requests to the /execute endpoint. While everything works fine when the request is made from the UI, I get an error related to SQLALCHEMY_TRACK_MODIFICATIONS during programmatic API requests. The error message is as follows: Error during run: 'SQLALCHEMY_TRACK_MODIFICATIONS' Here’s what I’ve already tried: Ensured configuration consistency between the backend and UI requests. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
Hi @wacken89
Hi Superset Community,
I'm encountering an issue when attempting to execute SQL queries programmatically through the /execute API in Superset. The issue is related to the SQLALCHEMY_TRACK_MODIFICATIONS setting, and I'm getting the following error:
arduino
Copy
Error during run: 'SQLALCHEMY_TRACK_MODIFICATIONS'
The relevant part of the log:
vbnet
Copy
superset_app | 2025-01-17 02:16:13,169:ERROR:superset.daos.query:Error during commit: 'SQLALCHEMY_TRACK_MODIFICATIONS'
superset_app | 2025-01-17 02:16:13,169:ERROR:superset.commands.sql_lab.execute:Error saving metadata: 'SQLALCHEMY_TRACK_MODIFICATIONS'
superset_app | 2025-01-17 02:16:13,170:ERROR:superset.commands.sql_lab.execute:Error during run: 'SQLALCHEMY_TRACK_MODIFICATIONS'
The issue occurs when making a request programmatically (not via the UI), even though I have confirmed that SQLALCHEMY_TRACK_MODIFICATIONS is set to False in the config. However, the same query works when sent from the UI.
Here’s the relevant code where the error occurs:
python
Copy
@transaction()
def run(self) -> CommandResult:
try:
query = self._try_get_existing_query()
if self.is_query_handled(query):
self._execution_context.set_query(query)
status = SqlJsonExecutionStatus.QUERY_ALREADY_CREATED
else:
status = self._run_sql_json_exec_from_scratch()
The error happens when saving metadata with this line:
python
Copy
self._query_dao.save_metadata(self._execution_context.query, self._execution_context_convertor.payload)
When I check the logs, I see the following related error:
javascript
Copy
Error during commit: 'SQLALCHEMY_TRACK_MODIFICATIONS'
I have verified that the database connection and user context are set up correctly, and the error is still occurring for backend requests while the same request works from the UI.
Can someone please help me troubleshoot this issue? Is there something I might have missed in the configuration or context setup?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions