Skip to content

Commit 6231e60

Browse files
authored
fix: use official SQL syntax from Spanner documentation for singers sample (#475)
Fixes SQL syntax error in the singers sample database that was preventing the embedded emulator from starting. The error was: "Syntax error: concatenated string literals must be separated by whitespace or comments" Updated singers-data.sql to use the exact SQL syntax from the official Spanner documentation: https://cloud.google.com/spanner/docs/query-execution-operators Changes: - Use double quotes for string literals (Spanner standard syntax) - Use exact data values from the official documentation - Remove intermediate comments that weren't in the original - Properly handle apostrophes in song titles like "Let's Get Back Together" This ensures the singers sample database loads correctly when using: spanner-mycli --embedded-emulator --sample-database=singers
1 parent 962099c commit 6231e60

File tree

1 file changed

+25
-45
lines changed

1 file changed

+25
-45
lines changed

samples/singers-data.sql

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,28 @@
1-
-- Sample data for music database
1+
-- Sample data from https://cloud.google.com/spanner/docs/query-execution-operators
22

3-
-- Insert singers
4-
INSERT INTO Singers (SingerId, FirstName, LastName, BirthDate) VALUES
5-
(1, 'Marc', 'Richards', '1970-09-03'),
6-
(2, 'Catalina', 'Smith', '1990-08-17'),
7-
(3, 'Alice', 'Trentor', '1991-10-02'),
8-
(4, 'Lea', 'Martin', '1991-11-09'),
9-
(5, 'David', 'Lomond', '1977-01-29');
3+
INSERT INTO Singers (SingerId, FirstName, LastName, BirthDate)
4+
VALUES (1, "Marc", "Richards", "1970-09-03"),
5+
(2, "Catalina", "Smith", "1990-08-17"),
6+
(3, "Alice", "Trentor", "1991-10-02"),
7+
(4, "Lea", "Martin", "1991-11-09"),
8+
(5, "David", "Lomond", "1977-01-29");
109

11-
-- Insert albums with MarketingBudget
12-
INSERT INTO Albums (SingerId, AlbumId, AlbumTitle, MarketingBudget) VALUES
13-
(1, 1, 'Total Junk', 100000),
14-
(1, 2, 'Go, Go, Go', 150000),
15-
(2, 1, 'Green', 200000),
16-
(2, 2, 'Forever Hold Your Peace', 175000),
17-
(2, 3, 'Terrified', 300000),
18-
(3, 1, 'Nothing To Do With Me', 50000),
19-
(4, 1, 'Play', 80000),
20-
(5, 1, 'Cake', 120000);
10+
INSERT INTO Albums (SingerId, AlbumId, AlbumTitle)
11+
VALUES (1, 1, "Total Junk"),
12+
(1, 2, "Go, Go, Go"),
13+
(2, 1, "Green"),
14+
(2, 2, "Forever Hold Your Peace"),
15+
(2, 3, "Terrified"),
16+
(3, 1, "Nothing To Do With Me"),
17+
(4, 1, "Play");
2118

22-
-- Insert songs
23-
INSERT INTO Songs (SingerId, AlbumId, TrackId, SongName, Duration, SongGenre) VALUES
24-
(1, 1, 1, 'Not About The Guitar', 213, 'BLUES'),
25-
(1, 1, 2, 'The Second Time', 227, 'ROCK'),
26-
(1, 2, 1, 'Starting Again', 288, 'ROCK'),
27-
(1, 2, 2, 'Let''s Get Back Together', 194, 'COUNTRY'),
28-
(1, 2, 3, 'I Knew You Were Magic', 203, 'BLUES'),
29-
(2, 1, 1, 'Nothing Is The Same', 303, 'METAL'),
30-
(2, 1, 2, 'Respect', 198, 'ELECTRONIC'),
31-
(2, 2, 1, 'The Second Title', 254, 'BLUES'),
32-
(2, 3, 1, 'Fight Story', 320, 'ROCK'),
33-
(3, 1, 1, 'Let Me', 204, 'COUNTRY'),
34-
(3, 1, 2, 'I Can''t Go On', 221, 'BLUES'),
35-
(4, 1, 1, 'Our Time', 197, 'ROCK'),
36-
(4, 1, 2, 'My Dear One', 196, 'BLUES'),
37-
(5, 1, 1, 'Blue', 238, 'BLUES'),
38-
(5, 1, 2, 'Sorry', 201, 'ROCK'),
39-
(5, 1, 3, 'Another Day', 194, 'COUNTRY');
40-
41-
-- Insert concerts with TicketPrices
42-
INSERT INTO Concerts (VenueId, SingerId, ConcertDate, BeginTime, EndTime, TicketPrices) VALUES
43-
(1, 1, '2018-05-01', TIMESTAMP '2018-05-01T19:00:00Z', TIMESTAMP '2018-05-01T21:00:00Z', [25, 50, 100]),
44-
(1, 2, '2018-05-01', TIMESTAMP '2018-05-01T21:30:00Z', TIMESTAMP '2018-05-01T23:30:00Z', [30, 60, 120]),
45-
(2, 1, '2019-01-15', TIMESTAMP '2019-01-15T20:00:00Z', TIMESTAMP '2019-01-15T22:00:00Z', [35, 70, 140]),
46-
(3, 2, '2019-06-20', TIMESTAMP '2019-06-20T18:00:00Z', TIMESTAMP '2019-06-20T20:00:00Z', [40, 80, 160]),
47-
(4, 3, '2020-09-10', TIMESTAMP '2020-09-10T19:30:00Z', TIMESTAMP '2020-09-10T21:30:00Z', [20, 40, 80]),
48-
(5, 4, '2021-03-25', TIMESTAMP '2021-03-25T20:00:00Z', TIMESTAMP '2021-03-25T22:30:00Z', [25, 45, 90]);
19+
INSERT INTO Songs (SingerId, AlbumId, TrackId, SongName, Duration, SongGenre)
20+
VALUES (2, 1, 1, "Let's Get Back Together", 182, "COUNTRY"),
21+
(2, 1, 2, "Starting Again", 156, "ROCK"),
22+
(2, 1, 3, "I Knew You Were Magic", 294, "BLUES"),
23+
(2, 1, 4, "42", 185, "CLASSICAL"),
24+
(2, 1, 5, "Blue", 238, "BLUES"),
25+
(2, 1, 6, "Nothing Is The Same", 303, "BLUES"),
26+
(2, 1, 7, "The Second Time", 255, "ROCK"),
27+
(2, 3, 1, "Fight Story", 194, "ROCK"),
28+
(3, 1, 1, "Not About The Guitar", 278, "BLUES");

0 commit comments

Comments
 (0)