Google Cloud Spanneris a highly scalable, transactional, managed, NewSQL database service.- Cloud Spanner solves the need for a horizontally-scaling database with consistent global transactions and SQL semantics.
This application demonstrates how to load data from a csv file into a Cloud Spanner database.
The data contained in the csv files is sourced from the "Hacker News - Y Combinator" Bigquery public dataset.
Create a database in your Cloud Spanner instance using the schema in the folder.
This sample requires you to have authentication setup. Refer to the Authentication Getting Started Guide for instructions on setting up credentials for applications.
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+.
MACOS/LINUX
$ virtualenv env $ source env/bin/activateWINDOWS
> virtualenv env > .\env\Scripts\activate
Install the dependencies needed to run the samples.
$ pip install -r requirements.txt
$ python batch_import.py instance_id database_id
- positional arguments:
instance_id: Your Cloud Spanner instance ID.
database_id : Your Cloud Spanner database ID.