You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "betodealmeida (via GitHub)" <gi...@apache.org> on 2024/07/30 16:47:53 UTC
[PR] fix: catalog upgrade/downgrade [superset]
betodealmeida opened a new pull request, #29780:
URL: https://github.com/apache/superset/pull/29780
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Many little improvements to the catalog migration helpers, especially on the downgrade.
- Works when the analytical DB is unreachable (fixed for schemas in #29549, this PR fixes catalogs)
- Delete catalog permissions on downgrade.
- Delete non-default catalog schema permissions on downgrade.
- Delete models on non-default catalog models.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
N/A
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
Updated and improved tests.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] 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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix: catalog upgrade/downgrade [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #29780:
URL: https://github.com/apache/superset/pull/29780#discussion_r1697457039
##########
superset/db_engine_specs/base.py:
##########
@@ -92,6 +92,12 @@
logger = logging.getLogger()
+# When connecting to a database it's hard to catch specific exceptions, since we support
+# more than 50 different database drivers. Usually the try/except block will catch the
+# generic `Exception` class, which requires a pylint disablee comment. To make it clear
+# that we know this is a necessary evil we create an alias, and catch it instead.
+GenericDBException = Exception
Review Comment:
In that case the exceptions from all the DB API drivers would not be derived from `GenericDBException`, so we wouldn't be able to catch them.
The only exception that is a parent to all the exceptions from the multitude of DB API drivers we support is `Exception` itself (I hope!), which is why we have to write:
```python
try:
# do something with some dynamically loaded DB API driver
except Exception: # pylint: disable=broad-except
pass
```
It's inevitable to have a broad except, because the drivers are loaded dynamically. My alias is just a way of saying "I know this is bad, but what can I do?", but also "I'm expecting an exception here that could be anything".
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix: catalog upgrade/downgrade [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on code in PR #29780:
URL: https://github.com/apache/superset/pull/29780#discussion_r1697432395
##########
superset/db_engine_specs/base.py:
##########
@@ -92,6 +92,12 @@
logger = logging.getLogger()
+# When connecting to a database it's hard to catch specific exceptions, since we support
+# more than 50 different database drivers. Usually the try/except block will catch the
+# generic `Exception` class, which requires a pylint disablee comment. To make it clear
+# that we know this is a necessary evil we create an alias, and catch it instead.
+GenericDBException = Exception
Review Comment:
nevermind, I understand now reading the code
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix: catalog upgrade/downgrade [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #29780:
URL: https://github.com/apache/superset/pull/29780#discussion_r1697457039
##########
superset/db_engine_specs/base.py:
##########
@@ -92,6 +92,12 @@
logger = logging.getLogger()
+# When connecting to a database it's hard to catch specific exceptions, since we support
+# more than 50 different database drivers. Usually the try/except block will catch the
+# generic `Exception` class, which requires a pylint disablee comment. To make it clear
+# that we know this is a necessary evil we create an alias, and catch it instead.
+GenericDBException = Exception
Review Comment:
In that case the exceptions from all the DB API drivers would not be derived from `GenericDBException`, so we wouldn't be able to catch them.
The only exception that is a parent to all the exceptions from the multitude of DB API drivers we support is `Exception` itself (I hope!), which is why we have to write:
```python
try:
# do something with some dynamically loaded DB API driver
except Exception: # pylint: disable=broad-except
pass
```
It's inevitable to have a broad except, because the drivers are loaded dynamically. My alias is just a way of saying "I know this is bad, but what can I do?", but also "I'm excepting an exception here that could be anything".
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix: catalog upgrade/downgrade [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida merged PR #29780:
URL: https://github.com/apache/superset/pull/29780
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix: catalog upgrade/downgrade [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on code in PR #29780:
URL: https://github.com/apache/superset/pull/29780#discussion_r1697423198
##########
superset/db_engine_specs/base.py:
##########
@@ -92,6 +92,12 @@
logger = logging.getLogger()
+# When connecting to a database it's hard to catch specific exceptions, since we support
+# more than 50 different database drivers. Usually the try/except block will catch the
+# generic `Exception` class, which requires a pylint disablee comment. To make it clear
+# that we know this is a necessary evil we create an alias, and catch it instead.
+GenericDBException = Exception
Review Comment:
why not ->
```python
class GenericDBException(Exception):
pass
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix: catalog upgrade/downgrade [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on PR #29780:
URL: https://github.com/apache/superset/pull/29780#issuecomment-2259181187
@supersetbot label 4.1
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org