Skip to content

[cloud-spanner-firstdb]: Database already exists #2197

Description

@thomasbdgt

During Step 5 of the Codelabs, we are asked to create a database that is then used during Step 6 with sampledb to populate it with some data.
But I got a traceback error stipulating that "Database already exists" because sample batch_import.py script is supposed to create and populate the database specified in the python batch_import.py <instance_id> <database_id> command.
I had to delete my existing empty database and create it directly using the batch_import.py script.

Extract of my console :
File "/home/username/sampledb/env/lib/python3.12/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.AlreadyExists: 409 Database already exists: projects/de-zoomcamp-493412/instances/codelabs-6398/databases/codelabs-db [resource_type: "type.googleapis.com/google.spanner.admin.database.v1.Database"
resource_name: "projects/de-zoomcamp-493412/instances/codelabs-6398/databases/codelabs-db"
description: "Database already exists."

Extract of the sampledb GitHub REAMDME.md file :

Run the application

python batch_import.py <instance_id> <database_id>
<instance_id>: your Cloud Spanner instance ID.
<database_id>: the Cloud Spanner database ID; the application will create and populate this database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions