Skip to content
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

Add watch command to inspect DBs continiously #58

Open
Aherontas opened this issue Oct 24, 2024 · 2 comments
Open

Add watch command to inspect DBs continiously #58

Aherontas opened this issue Oct 24, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request feature A big implementation

Comments

@Aherontas
Copy link
Collaborator

Something similar to: watch -n 5 psql -h localhost -U DB_USER -c "SELECT * FROM DB_TEST;" DB_TESTING.

In order to see changes in DB continuously via peepdb cli.

@Aherontas Aherontas added enhancement New feature or request feature A big implementation labels Oct 24, 2024
@Aherontas Aherontas self-assigned this Oct 24, 2024
@Aherontas
Copy link
Collaborator Author

The watch command could get the input timing dynamically. For now I have been testing it via bash script and expect:

`#!/usr/bin/expect -f

Set a timeout for each expect command

set timeout 5 # WE MUST FETCH THAT DYNAMICALLY

Infinite loop to execute the command every 2 seconds

while {1} {
spawn peepdb view test --page 40
expect {
"Please entry the password to encrpyt/decrpty DB passwords:" { send "test\r" }
timeout { puts "Password prompt not received"; continue }
}
expect eof
sleep 60
}`

@Aherontas
Copy link
Collaborator Author

A note is that watch in Unix simply re-runs a command every n seconds. However, it’s not particularly customizable in Python and also doesn't “follow” changes in the sense of keeping track of what was already displayed, so we would not go with that approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature A big implementation
Projects
None yet
Development

No branches or pull requests

1 participant