Skip to content

Added optional postgres functionality to db#157

Open
nick-fournier wants to merge 1 commit into
pageauc:masterfrom
nick-fournier:master
Open

Added optional postgres functionality to db#157
nick-fournier wants to merge 1 commit into
pageauc:masterfrom
nick-fournier:master

Conversation

@nick-fournier
Copy link
Copy Markdown

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
Copy Markdown
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