Overview of Cloud Spanner Node.js Samples
mainThe nodejs-spanner samples repository provides a comprehensive collection of code examples for interacting with Cloud Spanner using the Node.js client library. These samples cover a wide range of operations including:
- Backup Management: Creating, deleting, restoring, and canceling backups, including support for KMS encryption keys.
- Database Administration: Managing database roles, creating/updating databases, and configuring default leaders.
- Schema Management: Creating and altering tables, indexes, sequences, and foreign keys (including cascade actions) for both GoogleSQL and PostgreSQL dialects.
- Data Manipulation: Performing DML (Insert, Update, Delete) with
RETURNINGclauses, batch writes, and working with specialized types like JSON, JSONB, and Protobuf. - Querying: Executing SQL queries, using parameters, directed reads, and utilizing indexes.
- Transactions: Implementing read-write transactions with various isolation levels, lock modes, and timeouts.
- Instance Management: Configuring instances, autoscaling, and managing instance configurations.
- Observability: Implementing tracing with OpenTelemetry and OTLP.
- PostgreSQL Dialect: Specific samples for Spanner's PostgreSQL interface, including sequence management and dialect-specific syntax.