Learn more about Google Cloud Storage Export Integration.

The Data Connector for Google Cloud Storage enables import of the contents of .tsv and .csv files stored in your GCS bucket.

For sample workflows importing data from GCS, view the Treasure Boxes.


Prerequisites


You also need to generate and obtain a JSON key file from Google Developers Console. See Generating a service account credential.


Use TD Console

Create a New Connection

When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information.

  1. Open TD Console.

  2. Navigate to Integrations Hub >  Catalog

  3. Search and select Google Cloud Storage.


  4. The following dialog opens.


  5. Create a New Google Cloud Storage Connector


  6. Set the following parameters:

Parameters

Description

Authentication mode

Select a JSON keyfile. This method uses the JSON keyfile generated from the Google Developers Console.

JSON Keyfile

Copy and paste the contents of the JSON keyfile generated from the Google Developers Console in this field

Application Name

Treasure Data GCS Output is the default value. As this is an arbitrary client name associated with API requests, you can leave the default value (Treasure Data GCS Output).

Name Your Connection

  1. Type a name for your connection.

  2. Select Done.

Transfer Your Google Cloud Storage Account Data to Treasure Data

After creating the authenticated connection, you are automatically taken to Authentications.

  1. Search for the connection you created. 

  2. Select New Source.

Connection

  1. Type a name for your Source in the Data Transfer field.

  2. Click Next


Source Table

  1. Select Next.

  2. The Source Table dialog opens. Edit the following parameters


Parameters

Description

Bucket

Google Cloud Storage bucket name (Ex. your_bucket_name)

Path Prefix

Prefix of target keys. (Ex. logs/data_)

Path Regex

regexp to match file paths. If a file path doesn’t match with this pattern, the file is skipped. (Ex. .csv$ # in this case, a file is skipped if its path doesn’t match with this pattern)

Start after path

Inserts last_path parameter so that the first execution skips files before the path. (Ex. logs/data_20170101.csv)


Incremental

Enables incremental loading. If incremental loading is enabled, config diff for the next execution will include last_path parameter so that next execution skips files before the path. Otherwise, last_path will not be included.

Example: CloudFront

Amazon CloudFront is a web service that speeds up the distribution of your static and dynamic web content. You can configure CloudFront to create log files that contain detailed information about every user request that CloudFront receives. If you enable logging, you can save CloudFront logfiles, shown as follows:

[your_bucket] - [logging] - [E231A697YXWD39.2017-04-23-15.a103fd5a.gz]
[your_bucket] - [logging] - [E231A697YXWD39.2017-04-23-15.b2aede4a.gz]
[your_bucket] - [logging] - [E231A697YXWD39.2017-04-23-16.594fa8e6.gz]
[your_bucket] - [logging] - [E231A697YXWD39.2017-04-23-16.d12f42f9.gz]

In this case, the Source Table setting should be as shown:

Data Settings

  1. Select Next.
    The Data Settings page opens.

  2. Optionally, edit the data settings or skip this page of the dialog.



PARSER 

Parameters

Description

Type

Parses a value as a specified type. And then, it stores after converting to Treasure Data schema.

  • boolean

  • long

  • timestamp: will be imported as String type at Treasure Data (Ex. 2017-04-01 00:00:00.000)

  • double

  • string

  • json

Default timezone

Changes time zone of timestamp columns if the value itself doesn’t include time zone.

Total file count limit

Maximum number of files to read. (optional)

Schema Settings

You can name the columns and set the data type.


Data Preview 


Data Placement