Donnype opened a new pull request, #42705:
URL: https://github.com/apache/superset/pull/42705

   ### SUMMARY
   When 'Impersonate logged in user' is enabled on a MotherDuck database, embed 
the Superset username as session_name in the md: path so MotherDuck can 
attribute sessions to individual Superset users. This will allow MotherDuck to 
route users [to the same read 
replica](https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/read-scaling/#session-affinity-with-session-name),
 improving caching and consistency. 
   
   The parameter goes into the md: path rather than the SQLAlchemy URL query 
because it must reach MotherDuck at connection initialization: duckdb-engine 
applies unknown URL query parameters via SET after connecting, which the 
setting rejects. The path form works with both duckdb-engine and 
duckdb-sqlalchemy as-is. Characters structural to the path (& = %) are escaped 
since MotherDuck reads values literally.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   <img width="1858" height="1010" alt="Screen Shot 2026-08-03 at 14 06 00 PM" 
src="https://github.com/user-attachments/assets/9d5ab915-30a6-49e0-9c1c-3d630025d863";
 />
   
   After:
   <img width="1920" height="1056" alt="Screen Shot 2026-08-03 at 14 44 42 PM" 
src="https://github.com/user-attachments/assets/0435df6a-3f99-48a8-b318-eda62c1bc5bf";
 />
   
   ### TESTING INSTRUCTIONS
   Add MotherDuck as a database and tick "Impersonate logged in user". Execute 
this in SQL Lab:
   ```sql
   SELECT current_setting('motherduck_session_name');
   ```
   It should return `admin`.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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]

Reply via email to