gsdb stands for Google Sheet Database. It is a database service that is backed and stored using Google Sheet.
(This repo is under active development. It is extremely beta. However, any contribution is much appreciated)
The inspiration comes from hearing that levels.fyi scaling to millions using Google Sheet. There are many databases out there, most can run locally easily. However, provisioning the database in production often costs money and takes a while even if you are experienced.
When you are running a startup or just want to quickly prototype an idea, you want a simple database that's quick, free, and easily queryable. In addition, business/analytics folks often prefer using Excel over SQL. Using gsdb saves you the headaches of exporting data from your database in a suitable format for the non-eng folks to digest.
In order to use gsdb, you need to first create a folder in your own Google Drive and then share that with a service account created in the Google Cloud Console. If you are struggling with any of the steps below, check out Amit's guide on How to Upload Files to Google Drive with a Service Account.
- Go to Google Drive and make sure you have the right Google account selected.
- Select "My Drive" on the left hand side.
- Click "New" right above "My Drive" and select "New folder". You can name the folder anything (eg/ you can name it
gsdb
). This will be the root directory which your new database will be stored in.
Now we will create a Google Cloud service account and enable the necessary APIs:
- Go to Google Drive API and click
ENABLE
. You may need to go through the set up of a new Google Cloud Platform project if your organization doesn't have one. - Go to Google Sheet API and click
ENABLE
. - Now that both APIs have been enabled, let's create the service account by going to the credentials page under Google Cloud API & Services.
- Click
+ CREATE CREDENTIALS
near the top of the credentials page. - Choose
Service account
when given different types of credentials. - Fill out the
Service account details
and leave the rest blanket. This step will only affects the name of the service account. Then clickDONE
. - Now we can generate a new credential JSON file by going to Google Cloud API & Services -> Credentials. Under
Service Accounts
, you should see the newly created account in the previous step. - Click on the service account you just generated, then
KEYS
->ADD KEY
->Create new key
->JSON
. Complete the key creation by clickingCREATE
. Save the newly generated JSON key in a file (eg/ incredential.json
) and move it to a secure place. You will need it later. - In order for the newly created service account to access the folder created by you, you must share the permission. Right click on the folder created in Google Drive in the previous section, choose
Share
, and share it with the email address of the service account. The permission should beeditor
.
If you haven't finished the setup section above, please complete it first.
To run the application, do
git clone https://github.com/jessicaxiejw/gsdb
cd gsdb
go run main.go server -c <path to the JSON credential file of your service account> // eg/ go run main.go server -c credential.json
To add a table
curl telnet://localhost:9001 <<< "CREATE TABLE Persons (
LastName varchar(255),
FirstName varchar(255),
City varchar(255)
);
"
I am planning on releasing the binary in brew and other linux distros. However, for now, you will have to run the go binary.