-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Add GCF Python SQL samples #1655
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
Change-Id: Ib60712a5f3808b1fb99088e5e637304ef21e98c7
Change-Id: I0c6ca84695a1a593f46ddd922507eb0cb1e56879
|
Change-Id: Ia59f803bb2bd50842f047a6570ebbc86171d2898
Any idea why Travis build is failing? |
|
||
import pymysql | ||
|
||
is_production = getenv('SUPERVISOR_HOSTNAME') is not None |
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.
Do we have any more straightforward methods of detecting the environment? Even better, could we do try/except to simply try to connect to the unix socket and fallback to user settings if it doesn't work? (properly commented)
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.
We ideally should not use SUPERVISOR_HOSTNAME
. It may not be there in the future. You opt for a separate env var to contain the "key". So.. INSTANCE_CONNECTION_TYPE
with either unix_socket
(or empty string for default), of host
for traditional connections.
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.
The Node samples use the NODE_ENV
env var to determine whether a function has been deployed. For the sake of maintaining patterns across samples, is there a way we can do this here?
RE Travis build failure: Travis doesn't have the Cloud SQL proxy enabled. I believe we're intending to deprecate Travis in favor of Kokoro, but I don't know what the timeline on that is. @SurferJeffAtGoogle should I disable this test (on Travis) for now and move it to Kokoro, or will y'all take care of that later on? |
Edit 9/10/18: "best practices" samples are being merged into existing ones, so this should be good for review..
@andrewsg this should be good to review. 😄 |
Change-Id: I0bad3298fa138430a4073ce108412fd4a6af5854
Change-Id: Ibf5a90b3b8c02596f441b7d77cdf11b416260437
Change-Id: I3efeabd192be9c2c987846b0df7dcced016ddc49
Change-Id: I9d2901a737ab0bb7d74edefa69876704846fdf10
Change-Id: Ibb0341f51861ec5adcba136903c1df0567e97398
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.
lgtm but please hold off on merge until @SurferJeffAtGoogle has a chance to review changes to testing/test-env.tmpl.sh
and others.
export POSTGRES_INSTANCE= | ||
export POSTGRES_USER= | ||
export POSTGRES_PASSWORD= | ||
export POSTGRES_DATABASE= |
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.
We haven't standardized these names across languages/repos, and these names look fine.
Do not merge until CI is set up.@stew-r FYI
@andrewsg FYI -psycopg2
gives a warning about binary modules. I assume that we can ignore that?