Skip to content

Commit b6490b6

Browse files
authoredAug 22, 2024··
docs: change the example timestamps in Spanner Graph java sample code (#3295)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue]- - [x] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #3289 ☕️
1 parent 166af53 commit b6490b6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed
 

Diff for: ‎samples/snippets/src/main/java/com/example/spanner/SpannerGraphSample.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ static void createDatabaseWithPropertyGraph(
154154
+ " id INT64 NOT NULL,"
155155
+ " to_id INT64 NOT NULL,"
156156
+ " amount FLOAT64,"
157-
+ " create_time TIMESTAMP NOT NULL OPTIONS"
158-
+ " (allow_commit_timestamp=true),"
157+
+ " create_time TIMESTAMP NOT NULL,"
159158
+ " order_number STRING(MAX),"
160159
+ " FOREIGN KEY (to_id) REFERENCES Account (id)"
161160
+ ") PRIMARY KEY (id, to_id, create_time),"
@@ -316,7 +315,7 @@ static void insertUsingDml(DatabaseClient dbClient) {
316315
"INSERT INTO Account (id, create_time, is_blocked) "
317316
+ " VALUES"
318317
+ " (1, CAST('2000-08-10 08:18:48.463959-07:52' AS TIMESTAMP), false),"
319-
+ " (2, CAST('2000-08-12 08:18:48.463959-07:52' AS TIMESTAMP), true)";
318+
+ " (2, CAST('2000-08-12 07:13:16.463959-03:41' AS TIMESTAMP), true)";
320319
long rowCount = transaction.executeUpdate(Statement.of(sql));
321320
System.out.printf("%d record(s) inserted into Account.\n", rowCount);
322321
return null;
@@ -329,8 +328,8 @@ static void insertUsingDml(DatabaseClient dbClient) {
329328
String sql =
330329
"INSERT INTO AccountTransferAccount (id, to_id, create_time, amount) "
331330
+ " VALUES"
332-
+ " (1, 2, PENDING_COMMIT_TIMESTAMP(), 100),"
333-
+ " (1, 1, PENDING_COMMIT_TIMESTAMP(), 200) ";
331+
+ " (1, 2, CAST('2000-09-11 03:11:18.463959-06:36' AS TIMESTAMP), 100),"
332+
+ " (1, 1, CAST('2000-09-12 04:09:34.463959-05:12' AS TIMESTAMP), 200) ";
334333
long rowCount = transaction.executeUpdate(Statement.of(sql));
335334
System.out.printf("%d record(s) inserted into AccountTransferAccount.\n", rowCount);
336335
return null;

0 commit comments

Comments
 (0)
Please sign in to comment.