You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "oceantume (via GitHub)" <gi...@apache.org> on 2025/08/28 19:06:56 UTC
[I] superset CLI set-database-uri options are set up incorrectly [superset]
oceantume opened a new issue, #34891:
URL: https://github.com/apache/superset/issues/34891
### Bug description
When running `superset set-database-uri` there are a few issues you can encounter:
- `--database_name` and `--uri` options are optional in the command but required in the code, leading to raised exception when either is missing instead of a user-friendly feedback.
- `--skip_create` option's help text states the opposite of what it actually does: `Create the DB if it doesn't exist`.
### Screenshots/recordings
```
> superset set-database-uri
Loaded your LOCAL configuration at [/app/pythonpath/superset_config.py]
2025-08-28 18:27:47,608:INFO:superset.initialization:Setting database isolation level to READ COMMITTED
2025-08-28 18:27:49,783:INFO:superset.utils.database:Creating database reference for None
Traceback (most recent call last):
File "/app/.venv/bin/superset", line 10, in <module>
sys.exit(superset())
File "/app/.venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/app/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/app/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/app/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/app/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/app/.venv/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/app/.venv/lib/python3.10/site-packages/flask/cli.py", line 358, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/app/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/app/.venv/lib/python3.10/site-packages/superset/utils/decorators.py", line 266, in wrapped
return on_error(ex)
File "/app/.venv/lib/python3.10/site-packages/superset/utils/decorators.py", line 236, in on_error
raise ex
File "/app/.venv/lib/python3.10/site-packages/superset/utils/decorators.py", line 259, in wrapped
result = func(*args, **kwargs)
File "/app/.venv/lib/python3.10/site-packages/superset/cli/update.py", line 53, in set_database_uri
database_utils.get_or_create_db(database_name, uri, not skip_create)
File "/app/.venv/lib/python3.10/site-packages/superset/utils/database.py", line 56, in get_or_create_db
database.set_sqlalchemy_uri(sqlalchemy_uri)
File "/app/.venv/lib/python3.10/site-packages/superset/models/core.py", line 386, in set_sqlalchemy_uri
conn = make_url_safe(uri.strip())
AttributeError: 'NoneType' object has no attribute 'strip'
```
### Superset version
5.0.0
### Python version
3.10
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [ ] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
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.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: [I] superset CLI set-database-uri options are set up incorrectly [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #34891: superset CLI set-database-uri options are set up incorrectly
URL: https://github.com/apache/superset/issues/34891
--
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: [I] superset CLI set-database-uri options are set up incorrectly [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #34891:
URL: https://github.com/apache/superset/issues/34891#issuecomment-3234639435
<!-- Greeting -->
Hi @oceantume! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
<!-- Answer -->
You're correct—there are two main issues with the `set-database-uri` CLI command:
1. The `--database_name` and `--uri` options are defined as optional in the CLI, but the code requires them. If either is missing, the command fails with an unhandled exception instead of a user-friendly error message. This is due to the lack of validation before passing these arguments downstream, which leads to errors like `'NoneType' object has no attribute 'strip'` when `uri` is omitted ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/cli/update.py)).
2. The `--skip_create` flag's help text is misleading. It says "Create the DB if it doesn't exist," but when you use the flag, it actually skips database creation. The logic is inverted: setting `--skip_create` prevents creation, which is the opposite of what the help text suggests ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/cli/update.py)).
For now, always provide both `--database_name` and `--uri` when running the command, and be aware that `--skip_create` means "do not create the DB if it doesn't exist." There are no recent fixes or workarounds in the codebase for these issues.
Let me know if you need help with a workaround or want details on how to patch the CLI locally.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7c31defd-b7f2-44b5-8567-4b31df859af2?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
b) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34891)
--
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