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

Added optional postgres functionality to db #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nick-fournier
Copy link

I added support for a remote postgres database. I plan to operate multiple cameras on two devices that feed into a single database and will make a webserver that can then just query that single database to generate neat plots.

In order to do that I had to add a few dependencies, primarily psycopg2. I also added python-dotenv to securely store super secret stuff. I developed and tested in the dev container, so it should be good to go but I won't be offended if I made a bonehead mistake.

added psycopg2 to installs

working postgres implementation
@pageauc
Copy link
Owner

pageauc commented Mar 1, 2024

Thanks for your work on this project. I have reviewed your changes and have a few requests.

  1. If possible db_conn line 40 print statements should be changed to appropriate logging message.
  2. DB_TYPE in db_conn needs to be converted to lowercase since user might input mixed case.
  3. I prefer you move dotenv code out of config.py and move to db_conn.py. Move config.py DB_USER and DB_PASSWORD vars out. Add config.py comment regarding using .env file. I suggest moving logic to db_conn after elif DB_TYPE == 'postgres'. Check for .env file using find_dotenv(). If not found create .env file with required entries with None values. Then error out with message for user to edit the .env file to add progress db user and password to the .env file entries. For additional detail see https://stackoverflow.com/questions/64734118/environment-variable-not-loading-with-load-dotenv-in-linux.

Let me know what you think.

byw I setup a progressql db on one of my RPI's per https://pimylifeup.com/raspberry-pi-postgresql/

Have not tested. Will wait for your reply
Thanks Claude ...

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.

2 participants