Skip to content

Conversation

@rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Jan 30, 2026

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_file logic is incidentally improved.

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).
  • I ran uv run ruff check && uv run ruff format && uv run mypy --install-types . to lint and format the code.

@rolandwalker rolandwalker self-assigned this Jan 30, 2026
@scottnemes
Copy link
Contributor

I removed it on purpose because when prompting the user for a password at the start, the username is not yet known unless the --user/-u option is passed. So you'd have to move the config checks up higher, or it just shows None. But if that's what you want, then works as-is then anyway.

uv run mycli --password
Enter password for None:

uv run mycli -u scottn --password
Enter password for scottn:

user = user or cnf["user"] or os.getenv("USER")

@rolandwalker
Copy link
Contributor Author

I see. We don't have cnf yet.

@rolandwalker rolandwalker force-pushed the RW/show-user-in-password-prompt branch 2 times, most recently from cd5ca0b to e77def3 Compare January 31, 2026 21:12
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.
@rolandwalker rolandwalker force-pushed the RW/show-user-in-password-prompt branch from e77def3 to 5a07d42 Compare January 31, 2026 21:13
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')
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants