agrc / palletjack

A library for updating AGOL data from various external sources
https://agrc.github.io/palletjack/palletjack/
MIT License
12 stars 0 forks source link

Handle Postgres connection when running in Cloud Run #38

Closed stdavis closed 1 year ago

stdavis commented 1 year ago

This was all working great on my local machine but failed to connect to the database when I pushed it as a cloud function. This PR branches the engine creation method based on the runtime environment.

Ref: https://cloud.google.com/sql/docs/postgres/connect-functions

codecov[bot] commented 1 year ago

Codecov Report

Base: 91.56% // Head: 91.18% // Decreases project coverage by -0.38% :warning:

Coverage data is based on head (4006ea9) compared to base (302ac9b). Patch coverage: 57.14% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #38 +/- ## ========================================== - Coverage 91.56% 91.18% -0.39% ========================================== Files 6 6 Lines 688 692 +4 Branches 91 92 +1 ========================================== + Hits 630 631 +1 - Misses 52 54 +2 - Partials 6 7 +1 ``` | [Impacted Files](https://codecov.io/gh/agrc/palletjack/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=agrc) | Coverage Δ | | |---|---|---| | [src/palletjack/loaders.py](https://codecov.io/gh/agrc/palletjack/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=agrc#diff-c3JjL3BhbGxldGphY2svbG9hZGVycy5weQ==) | `87.62% <57.14%> (-1.27%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=agrc). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=agrc)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

jacobdadams commented 1 year ago

@stdavis, the new version has been uploaded to pypi.

steveoh commented 1 year ago

@jacobdadams I wrote this for sweeper if you want to crib it to automate publishing to pypi. https://github.com/agrc/sweeper/blob/main/.github/workflows/python.yml