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

docs: create a few code snippets as examples for using Spanner Graph using cpp #14660

Merged
merged 12 commits into from
Sep 12, 2024

Conversation

bharadwajvr
Copy link
Contributor

@bharadwajvr bharadwajvr commented Aug 22, 2024

Add a few code snippets to illustrate how to use Spanner Graph functionality in Java. These examples resemble other snippets for how various other Spanner features can be used.

Fixes #14659


This change is Reviewable

@bharadwajvr bharadwajvr marked this pull request as ready for review August 22, 2024 23:38
@bharadwajvr bharadwajvr requested a review from a team as a code owner August 22, 2024 23:38
Copy link

snippet-bot bot commented Aug 22, 2024

Here is the summary of changes.

You are about to add 9 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@dbolduc
Copy link
Member

dbolduc commented Aug 23, 2024

/gcbrun

Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @bharadwajvr)


google/cloud/spanner/samples/graph_samples.cc line 43 at r2 (raw file):

//! [START spanner_create_database_with_property_graph]
void CreateDatabaseWithPropertyGraph(
		google::cloud::spanner_admin::DatabaseAdminClient client,

Looks like there's some formatting that needs be applied. Running ci/cloudbuild/build.sh -t checkers-pr locally should take care of it.


google/cloud/spanner/samples/graph_samples.cc line 419 at r2 (raw file):

  using CommandMap = std::map<std::string, CommandType>;

  using SampleFunction = void (*)(google::cloud::spanner::Client);

Prefer using std::function instead of C style function pointers, here and elsewhere:

using SampleFunction = std::function<void(google::cloud::spanner::Client)>;

google/cloud/spanner/samples/spanner_client_integration_samples.bzl line 15 at r2 (raw file):

# limitations under the License.
#
# DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed

You'll want to edit spanner/samples/CMakeLists.txt to add graph_samples.cc

Copy link
Contributor Author

@bharadwajvr bharadwajvr left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @scotthart)


google/cloud/spanner/samples/graph_samples.cc line 43 at r2 (raw file):

Previously, scotthart (Scott Hart) wrote…

Looks like there's some formatting that needs be applied. Running ci/cloudbuild/build.sh -t checkers-pr locally should take care of it.

I tried this and I run into compilation errors in typos-cli v1.16.1 - errors E0277, E0308.
Googling didn't help me find a fix. Is this something you recognize and can help me fix?


google/cloud/spanner/samples/graph_samples.cc line 419 at r2 (raw file):

Previously, scotthart (Scott Hart) wrote…

Prefer using std::function instead of C style function pointers, here and elsewhere:

using SampleFunction = std::function<void(google::cloud::spanner::Client)>;

Done.


google/cloud/spanner/samples/spanner_client_integration_samples.bzl line 15 at r2 (raw file):

Previously, scotthart (Scott Hart) wrote…

You'll want to edit spanner/samples/CMakeLists.txt to add graph_samples.cc

Done.

Copy link
Contributor Author

@bharadwajvr bharadwajvr left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @scotthart)


google/cloud/spanner/samples/graph_samples.cc line 43 at r2 (raw file):

Previously, bharadwajvr wrote…

I tried this and I run into compilation errors in typos-cli v1.16.1 - errors E0277, E0308.
Googling didn't help me find a fix. Is this something you recognize and can help me fix?

Rebased to updated main and that fixed the problem. Formatting changes are applied now.

@scotthart
Copy link
Member

/gcbrun

@bharadwajvr
Copy link
Contributor Author

Gentle reminder: @scotthart

@dbolduc
Copy link
Member

dbolduc commented Sep 10, 2024

/gcbrun

@scotthart
Copy link
Member

/gcbrun

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 3.61842% with 293 lines in your changes missing coverage. Please review.

Project coverage is 93.49%. Comparing base (41b1152) to head (f119a1e).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
google/cloud/spanner/samples/graph_samples.cc 3.61% 293 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14660      +/-   ##
==========================================
- Coverage   93.62%   93.49%   -0.13%     
==========================================
  Files        2320     2321       +1     
  Lines      207209   207513     +304     
==========================================
+ Hits       193997   194019      +22     
- Misses      13212    13494     +282     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions

Copy link
Contributor Author

@bharadwajvr bharadwajvr left a comment

Choose a reason for hiding this comment

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

Ignoring the code-coverage data here since this is sample code.

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @scotthart)

@scotthart scotthart merged commit 9b51e16 into googleapis:main Sep 12, 2024
70 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create samples for Cloud Spanner Graph
3 participants