Member-only story
How to Use SpiceDB Bulk Import API for Relationships in Go
Introduction
SpiceDB is a robust authorization engine that offers an effective method for managing access control through relationships. When bulk operations are needed, such as importing numerous relationships, SpiceDB's BulkImport API can streamline the process, reducing time and overhead compared to individual inserts. BulkImport API is exposed under ExperimentalService from Spicedb.
EXPERIMENTAL https://github.com/authzed/spicedb/issues/1303
In this blog, I’ll show you how to use the SpiceDB BulkImport API in Go to import many relationships. We’ll build a thin wrapper around the SpiceDB client to perform bulk imports.
Setting Up Your Project
Prerequisites
- Go installed: Ensure that Go is installed on your machine (version 1.20 or higher).
- zed: Official command-line tool for managing SpiceDB
- Docker/Podman
- grpcurl
Code Repository
git clone https://github.com/akoserwal/spicedb-examples
cd BulkImportAPI
Step 1: Run Spicedb using the `docker-compose`
make spicedb-up