Copilot commented on code in PR #38443:
URL: https://github.com/apache/superset/pull/38443#discussion_r2897238493
##########
superset/db_engine_specs/gsheets.py:
##########
@@ -389,8 +404,14 @@ def validate_parameters(
engine = create_engine(
"gsheets://",
- service_account_info=encrypted_credentials,
- subject=subject,
+ connect_args={
+ "adapter_kwargs": {
+ "gsheetsapi": {
+ "service_account_info": encrypted_credentials,
+ "subject": subject,
+ }
+ }
+ },
)
conn = engine.connect()
idx = 0
Review Comment:
`validate_parameters` opens a SQLAlchemy connection via `engine.connect()`
but never closes it. Since this method can return early (eg, missing name/url)
or loop over multiple entries, this can leak connections/handles; wrap the
connection in a context manager (or `try/finally`) and ensure the connection
(and optionally the engine) is closed/disposed.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]