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 samples for using Cloud SQL with App Engine Python 3.7 Standard #1672

Merged
merged 9 commits into from
Oct 11, 2018

Conversation

michaelawyu
Copy link
Contributor

Pending approval of the new doc page.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 29, 2018
@michaelawyu
Copy link
Contributor Author

The linter only supports Python 2.7 :(

import os

from flask import Flask
import mysql.connector
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might be intentionally standardizing on pymysql as it has the largest usage share and is easiest for our users to install. Is there a particular reason to go with mysql connector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pymysql does not have built-in support for connection pooling :(

cursor.execute('SELECT NOW() as now;')
result = cursor.fetchall()
current_time = result[0][0]
cursor.close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The adaptor doesn't support anything like "with" statements (context managers) here, do they?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the reference and it does not seem to have the __enter__ and __exit__ method.

result = cursor.fetchall()
current_time = result[0][0]
cursor.close()
# If the connection comes from a pool, close() will send the connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good comment here!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Oct 10, 2018
@michaelawyu
Copy link
Contributor Author

@andrewsg Package updated, PTAL. Not sure why the CLA bot is triggered :(

@michaelawyu
Copy link
Contributor Author

New year resolution: Make the Linter recognize F-string. Everyone should use F-string!

@andrewsg
Copy link
Member

CLA bot is due to lack of github tag in some commits for Chen, should be resolved going forward

@michaelawyu michaelawyu changed the title [DO NOT MERGE] Added samples for using Cloud SQL with App Engine Python 3.7 Standard Added samples for using Cloud SQL with App Engine Python 3.7 Standard Oct 11, 2018
@andrewsg andrewsg merged commit e461e9a into master Oct 11, 2018
@michaelawyu michaelawyu deleted the michaelawyu-patch-appengine-py37-cloudsql branch October 11, 2018 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: no This human has *not* signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants