-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 sample for using Cloud Spanner with App Engine Python 3.7 runtime. #1757
Conversation
|
||
env_variables: | ||
SPANNER_INSTANCE_ID: "YOUR-SPANNER-INSTANCE-ID" | ||
SPANNER_DATABASE_ID: "YOUR-SPANNER-DATABASE-ID" |
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.
nit: add CR
def test_main(): | ||
import main | ||
|
||
spanner.Client = MagicMock() |
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 have to mock this because spanner is too expensive a service to leave running all the time for our tests, right?
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 created a new Spanner DB in the project and updated the sample to use the real Spanner instance.
app = Flask(__name__) | ||
spanner_client = spanner.Client() | ||
|
||
instance_id = os.environ.get('SPANNER_INSTANCE_ID') |
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 could go either way with these variable names being all caps or lowercase; is lowercase the pattern we follow in mysql/postgres samples?
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.
In the MySQL/PostgreSQL samples the lowercase pattern is used :)
No description provided.