Skip to content

Conversation

@apstndb
Copy link
Owner

@apstndb apstndb commented Sep 7, 2025

Summary

Fixes SQL syntax error in the singers sample database that was causing the embedded emulator to fail on startup.

Problem

The embedded emulator was failing with this error:

Syntax error: concatenated string literals must be separated by whitespace or comments [at 5:18]
  (1, 2, 2, 'Let''s Get Back Together', 194, 'COUNTRY'),

Solution

Updated the singers sample data 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
  • Properly handle apostrophes in song titles like "Let's Get Back Together"

Testing

Verified the fix works:

$ spanner-mycli --embedded-emulator --sample-database=singers -e "SELECT COUNT(*) FROM Singers"
+---+
|   |
+---+
| 5 |
+---+

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @apstndb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue where the singers sample database failed to load in the embedded Spanner emulator due to non-compliant SQL syntax. The changes align the sample data's SQL with the official Spanner documentation, ensuring the sample database initializes correctly and consistently.

Highlights

  • SQL Syntax Correction: Resolved a SQL syntax error in the singers sample database that prevented the embedded emulator from starting. The error was due to incorrect string literal concatenation.
  • Spanner Documentation Alignment: Updated the sample data to strictly adhere to the official SQL syntax and data values provided in the Spanner documentation. This includes using double quotes for string literals and adjusting data entries.
  • Apostrophe Handling: Ensured proper handling of apostrophes within song titles, such as "Let's Get Back Together", to prevent parsing errors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a critical SQL syntax error in the singers-data.sql sample file, allowing the embedded emulator to start. The changes align the sample data with the official Spanner documentation by using the correct string literal syntax and data values. However, by removing data for the Concerts table and the MarketingBudget column, the data file is now inconsistent with the singers-schema.sql file, which still defines these elements. This could be confusing for users. I have added a comment to highlight this discrepancy for future improvement.

@github-actions
Copy link

github-actions bot commented Sep 7, 2025

Code Metrics Report

📊 View detailed coverage report (available for 7 days)

main (962099c) #475 (8d29b25) +/-
Coverage 70.0% 69.9% -0.2%
Code to Test Ratio 1:1.2 1:1.2 0.0
Test Execution Time 34s 34s 0s
Details
  |                     | main (962099c) | #475 (8d29b25) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          70.0% |          69.9% | -0.2% |
  |   Files             |             53 |             53 |     0 |
  |   Lines             |           5765 |           5765 |     0 |
- |   Covered           |           4041 |           4034 |    -7 |
  | Code to Test Ratio  |          1:1.2 |          1:1.2 |   0.0 |
  |   Code              |          13163 |          13163 |     0 |
  |   Test              |          16457 |          16457 |     0 |
  | Test Execution Time |            34s |            34s |    0s |

Code coverage of files in pull request scope (66.6% → 64.9%)

Files Coverage +/- Status
execute_sql.go 73.0% -0.6% affected
execution_metrics.go 0.0% -11.2% affected

Reported by octocov

…ample

The embedded emulator was failing with SQL syntax errors when loading
the singers sample database. Updated to use the exact SQL from the
official Spanner documentation at:
https://cloud.google.com/spanner/docs/query-execution-operators

Changes:
- Use double quotes for string literals (Spanner standard)
- Use exact data values from the official documentation
- Properly handle apostrophes in song titles like "Let's Get Back Together"
@apstndb apstndb force-pushed the fix-singers-sample-sql branch from c8a7cd8 to be74104 Compare September 7, 2025 06:17
@apstndb
Copy link
Owner Author

apstndb commented Sep 7, 2025

/gemini summary

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request addresses a critical issue preventing the embedded Spanner emulator from starting by correcting SQL syntax within the singers sample database. The changes bring the sample data in line with official Google Cloud Spanner documentation, ensuring proper string literal handling and data values, which resolves the startup failure and improves the reliability of the sample.

Highlights

  • Emulator Startup Fix: Resolved an issue where the embedded emulator failed to start due to SQL syntax errors in the singers sample database.
  • SQL Syntax Alignment: Updated the sample data to strictly adhere to the official Google Cloud Spanner documentation's SQL syntax.
  • String Literal Quoting: Switched from single quotes to double quotes for string literals, which is the standard Spanner syntax.
  • Data Consistency: Ensured the sample data values, including handling of apostrophes in song titles, precisely match those provided in the official Spanner documentation.
Changelog
  • samples/singers-data.sql
    • Updated file header comment to reference the official Spanner documentation source.
    • Modified INSERT statements for Singers, Albums, and Songs to use double quotes for string literals instead of single quotes.
    • Adjusted the data values and structure for Albums and Songs to match the official documentation, including the removal of the MarketingBudget column from Albums inserts and a complete overhaul of the Songs data.
    • Removed the INSERT statement for Concerts entirely, as it is not present in the referenced official documentation.
    • Corrected the handling of apostrophes in song titles (e.g., "Let's Get Back Together") to prevent syntax errors.
Activity
  • A bot (github-actions[bot]) posted a Code Metrics Report, indicating a minor decrease in overall code coverage (-0.2%).
  • The pull request author (apstndb) requested a summary using the /gemini summary command.

@apstndb apstndb merged commit 6231e60 into main Sep 7, 2025
2 checks passed
@apstndb apstndb deleted the fix-singers-sample-sql branch September 7, 2025 06:20
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.

2 participants