1.0 KiB
1.0 KiB
Install gcloud cli
https://cloud.google.com/sdk/docs/install
Run spanner docker
https://cloud.google.com/spanner/docs/emulator#start-emulator-gcloud
Set gcloud cli to point to local
export SPANNER_EMULATOR_HOST=localhost:9010
Run spanner code on terminal
# Create instances
gcloud spanner instances create testinstance \
--config=emulator-config \
--description="Test Instance" \
--nodes=1
# Create database
gcloud spanner databases create testdb --instance=testinstance
# Create table
gcloud spanner databases ddl update testdb --instance=testinstance \
--ddl="CREATE TABLE Singers (
SingerId INT64 NOT NULL,
FirstName STRING(1024),
LastName STRING(1024),
SingerInfo BYTES(MAX)
) PRIMARY KEY (SingerId)"
Connect to spanner through dbeaver
- Install DBeaver CE (free) on Mac.
- Install the Spanner JDBC driver.
- Create a new connection → Google Cloud Spanner. • Project ID: test-project • Instance: testinstance • Database: testdb • set autoConfigEmulator to true