FrancescoCastaldi opened a new pull request, #43586: URL: https://github.com/apache/superset/pull/43586
### SUMMARY Fixes #43300. When uploading files (CSV, Excel, Columnar), \UploadCommand\ in \superset/commands/database/uploaders/base.py\ created datasets (\SqlaTable\) without setting \catalog\. On catalog-supporting databases (e.g. PostgreSQL, Databricks, Trino), this resulted in datasets having \schema_perm\ generated as \[db].[schema]\ instead of \[db].[catalog].[schema]\. Consequently, non-admin users with schema permissions on the target schema could not see the uploaded dataset in the Datasets list or charts in the Charts list. #### Changes 1. In \UploadCommand.run()\, retrieve \catalog = self._model.get_default_catalog()\. 2. Include \catalog=catalog\ when querying existing \SqlaTable\ instances and in \ind_soft_deleted_logical_duplicate\. 3. Pass \catalog=catalog\ when creating new \SqlaTable\ objects, and set \sqla_table.catalog = catalog\ if an existing dataset on a catalog-enabled database had \catalog=None\. 4. Added unit tests in \ ests/unit_tests/commands/databases/upload_command_test.py\ verifying default catalog assignment and existing dataset repair during file uploads. ### TESTING INSTRUCTIONS 1. Run \pytest tests/unit_tests/commands/databases/upload_command_test.py\. 2. On a catalog-enabled database, upload a file and verify that the created dataset has \catalog\ set and matches the user's schema permissions. ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #43300 - [ ] Changes UI - [ ] Requires DB Migration -- 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]
