-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Added samples for using Cloud SQL with App Engine Python 3.7 Standard #1672
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
The linter only supports Python 2.7 :( |
import os | ||
|
||
from flask import Flask | ||
import mysql.connector |
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.
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?
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.
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() |
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 adaptor doesn't support anything like "with" statements (context managers) here, do they?
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.
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 |
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.
Good comment here!
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.
Thanks :)
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. |
@andrewsg Package updated, PTAL. Not sure why the CLA bot is triggered :( |
New year resolution: Make the Linter recognize F-string. Everyone should use F-string! |
CLA bot is due to lack of github tag in some commits for Chen, should be resolved going forward |
Pending approval of the new doc page.