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