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 sample for using Cloud Spanner with App Engine Python 3.7 runtime. #1757

Merged
merged 7 commits into from
Oct 24, 2018

Conversation

michaelawyu
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 12, 2018

env_variables:
SPANNER_INSTANCE_ID: "YOUR-SPANNER-INSTANCE-ID"
SPANNER_DATABASE_ID: "YOUR-SPANNER-DATABASE-ID"
Copy link
Member

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()
Copy link
Member

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?

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 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')
Copy link
Member

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?

Copy link
Contributor Author

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 :)

@michaelawyu michaelawyu merged commit 7f57979 into master Oct 24, 2018
@michaelawyu michaelawyu deleted the michaelawyu-patch-appengine-py37-spanner branch October 24, 2018 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants