-
Notifications
You must be signed in to change notification settings - Fork 680
Show user in password prompt (fixing regression) #1495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I removed it on purpose because when prompting the user for a password at the start, the username is not yet known unless the Line 507 in a237ee9
|
|
I see. We don't have |
cd5ca0b to
e77def3
Compare
In order to do this, we have to lose some special DSN logic. There is just no way under the current setup, since for instance the SSL params get parsed out of the DSN before calling connect(). Once solution could be to do all configuration parsing early, a long- term goal. Here we replace the DSN fallthrough with a warning message. The password_from_file logic is incidentally improved.
e77def3 to
5a07d42
Compare
mycli/main.py
Outdated
| if passwd and '://' in passwd: | ||
| is_valid_scheme, _scheme = is_valid_connection_scheme(passwd or '') | ||
| if is_valid_scheme: | ||
| click.secho('Warning: password looks like a DSN. Check the command line.', err=True, fg='yellow') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing the logic to catch the case where they use the password flag and also provide a DSN? We keep going around in circles on this, but seems you just want it this way and did not previously say so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind I realized you mentioned this in your original PR description. You're removing it because it changes the way things work when all of the related logic is moved to the new location. I'll see if I can figure anything else out. Though I'd question if having the user in the prompt is more important, but that part is up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit that I believe gives you what you wanted plus keeping the original functionality (was easier than trying to explain it, so feel free to revert if you don't want it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made one more small change; realized that when I moved the line up to check the vendor configs for a password it changed the password hierarchy, so I moved it back to where it was now that it worked as expected.
Description
It would seem that there was a regression in #1436, and we need to redo #1291.
In order to do this, we have to lose some special DSN logic. There is just no way under the current setup, since for instance the SSL params get parsed out of the DSN before calling
connect().Once solution could be to do all configuration parsing early, a long-term goal.
Here we replace the DSN fallthrough with a warning message.
The
password_from_filelogic is incidentally improved.Checklist
changelog.md.AUTHORSfile (or it's already there).uv run ruff check && uv run ruff format && uv run mypy --install-types .to lint and format the code.