bito-code-review[bot] commented on PR #43994:
URL: https://github.com/apache/superset/pull/43994#issuecomment-5584877758
<!-- Bito Reply -->
The flagged issue is correct. In `superset/models/sql_lab.py`, the
`schema_perm` property assumes `self.database` is always present, which can
cause an `AttributeError` for transient queries that only have a `database_id`.
To resolve this, you should safely access the database attribute or handle
the case where it is unset. Here is a suggested fix for
`superset/models/sql_lab.py`:
```python
@property
def schema_perm(self) -> str:
if not self.database:
return ""
return security_manager.get_schema_perm(
self.database.database_name,
getattr(self, "catalog", None),
self.schema,
) or ""
```
There are no other comments on this PR to address. Would you like me to
check for any other potential issues in this file?
**superset/models/sql_lab.py**
```
@property
def schema_perm(self) -> str:
if not self.database:
return ""
return security_manager.get_schema_perm(
self.database.database_name,
getattr(self, "catalog", None),
self.schema,
) or ""
```
--
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]