Skip to content

Quickly get a sample database into Cloud Spanner

License

Notifications You must be signed in to change notification settings

halio-g/sampledb

 
 

Repository files navigation

SampleDB

cloudspannerecosystem

This application allows you to quickly get a sample database into Cloud Spanner. It does so by loading data from a CSV file into a new Cloud Spanner database.

The data contained in the CSV file is sourced from the "Hacker News - Y Combinator" BigQuery public dataset.

Please feel free to report issues and send pull requests, but note that this application is not officially supported as part of the Cloud Spanner product.

Setup

Create an instance

Create a Cloud Spanner instance if you haven't already done so. Remember the instance name, as you'll need it when running the application.

Authentication

This sample requires you to have authentication set up. Refer to the Authentication Getting Started Guide for instructions on setting up credentials for applications.

Install Dependencies

  • Install pip and virtualenv if you do not already have them. You may want to refer to the Python Development Environment Setup Guide for Google Cloud Platform for instructions.

  • Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

    virtualenv env
    source env/bin/activate
    
  • Install the dependencies needed to run the samples.

    pip install -r requirements.txt
    

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.

About

Quickly get a sample database into Cloud Spanner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%