-
Notifications
You must be signed in to change notification settings - Fork 578
Add a configuration option to execute commands on startup. #1294
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
Conversation
Codecov ReportBase: 84.15% // Head: 79.40% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1294 +/- ##
==========================================
- Coverage 84.15% 79.40% -4.75%
==========================================
Files 21 24 +3
Lines 2720 2904 +184
==========================================
+ Hits 2289 2306 +17
- Misses 431 598 +167
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
j-bennet
left a comment
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.
A unit test for this feature would be helpful. You'd want to test a few use cases:
- single command, valid SQL
- single command, invalid SQL
- multiline command.
For some examples, look at https://github.com/dbcli/pgcli/blob/master/tests/test_main.py.
|
Hey @mlefebvre, do you need some help with this PR? This seems like a useful feature, would be nice to get it in. |
|
Hi @mlefebvre, I tested your PR, things work fine. If you rebase on main, I'll merge this without a test. |
j-bennet
left a comment
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.
Ok to rebase and merge.
69f4e8e to
79eb792
Compare
|
Sorry @j-bennet , I had completely forgotten about this! We found a different way to achieve what we wanted to do, so we didn't need the feature anymore. |
79eb792 to
31879f9
Compare
|
Thank you for getting back to me. If you don't intend to continue working on it, I'll close the PR. Can you share how you solved this, so other users can benefit from your solution? |
|
I'm also curious about solutions others have come up with, I tend to connect and immediately search history so I can run |
|
For others following - this was implemented in #1504 🎉 |
Description
Related issue: #247
I needed a way to execute commands on startup (like
SET default_transaction_read_only = onwhen connecting on a production server), so I added a new startup_command configuration option.Checklist
changelog.rst.AUTHORSfile (or it's already there).pip install pre-commit && pre-commit install), and ranblackon my code.