in experiments/arena/config/spanner_config.py [0:0]
def create_database(self, exists_ok: bool = False):
"""Create Spanner database if it does not exist."""
try:
operation = self.database.create()
# Wait for the operation to complete
log(f"Creating database {self.spanner_database_id}.")
log(f"Adding to Spanner instance {self.spanner_instance_id} in project {self.project_id}.")
operation.result(config.SPANNER_TIMEOUT)
log("Database created successfully.")
except Exception as e:
if "Database already exists" in str(e) and exists_ok:
log("Database already exists, skipping creation.")
return
raise Exception(f"Error creating database: {e}") from e