Cloud Storage Load Generator (BigQuery)

Cloud Storage Load Generator (BigQuery)


Overview

Cloud Storage Load Generator is a tool that helps users load delimited data from public objects in Google Cloud Storage.

Unlike common components, the Cloud Storage Load Generator does not appear as a standalone component when dragged onto the Matillion ETL job canvas. Instead, the Load Generator takes the form of a tool that allows users to load and view files on the fly, altering Load component properties and seeing their effects without the need for a separate Transformation job. The Load Generator can also "guess" the schema of a table, relieving much of the end user's work.


Layout

When a user drags the Cloud Storage Load Generator onto the canvas, a three-page setup wizard is activated, see the below images.

A file must first be selected from a Google Cloud Storage Bucket. This file must be delimited (including .csv) and the user must have permission to access the file. If the file is compressed, the correct compression method must be selected; supported compression methods are gzip and bzip2.

If the selected file is viable, users can select the number of rows they wish to sample and click the Get Sample button. Here, the tool will load the file's data and attempt to guess its schema. Raw data for the file is displayed in the large panel below.

On page 2, column data is displayed in the lower-right panel and is available for editing. Schema configuration properties for the table are displayed in the lower-left panel; the available properties are detailed in the below table (article section "Properties").

Selecting the Guess Schema button will order the Load Generator to attempt to guess as many of these properties as possible. However, all of the properties are available for manual editing by the user, as is the column data in the lower-right panel.

When the user is satisfied with the settings, the resulting table output can be viewed by selecting the 'Test' button at the bottom of page 3 of the setup wizard. Running a test will create the requested table on the BigQuery cluster and show a sample for the user to inspect. If the user is unhappy with the output, they can return to the 'Configuration' panel on page 2 to make alterations until they are satisfied with the result.

 

Properties

Property Setting  
For more information on all the settings in this component, see the Google BigQuery documentation for more information.
Table Name Text The descriptive name of the table.
Max Error Text Set the maximum number of individual parsing errors that cause the whole load to fail. Values up to this will be substitued as null values.
Delimiter Text The delimiter separates columns; the default is a Comma (,). A [TAB] character can be specified as "\ ".
Quote Characters Text Quote character to use to enclose records. Default (field left blank) is double-quote ("). To indicate no quote character at all, use an empty string.
Skip Header Rows Text Type in an integer number of "Header" rows at the top the file to skip.
Ignore Unknown Checkbox Ticked: Accept rows that contain values that do not match the schema. Unknown values are ignored. (Note: Will ignore extra values at the end of a line for CSV files.)
Unticked: Omit any rows with invalid values.
Quoted New Lines Checkbox Tick to allow a CSV value to contain a new line character when the value is encased in quotation marks. Otherwise, a new line character, regardless of quotations, is always considered a new row.
Jagged Rows Checkbox Tick to ensure missing values are treated as 'null' but accepted. Otherwise, rows with missing data are treated as bad records. Note: A bad record will count toward the 'Maximum Errors' count.

 

Example

In the following example, the Cloud Storage Load Generator is used to load the contents of a small file into a table. First, the Load Generator is given the path to the file, and since the file is not compressed, we keep the Compression setting set to "None". After taking a sample of the data, the large panel displays raw data from the file (up to the number of lines specified by the 'Row Limit', and we can see that this dataset is a list of US states and their airport codes, delimited by white space.

 

On page 2, clicking 'Guess Schema' will enable the Load Generator to autocomplete the properties for this file. In the properties panel (lower left panel), the Load Generator has identified the whitespaces as tabs.

However, in the lower-right panel, we can see that only one column of our two-column dataset has been guessed by the wizard.

 

On the final page of the setup wizard, clicking the 'Test' button returns an error to our example. Although the data appears to be delimited correctly, we have already identified that our problem is with the column names. Load Generator has guessed (incorrectly in this particular case) only one column name, and also not provided the correct name. Now is our chance to go back through the wizard and make the necessary corrections.

 

To correct the problems, we simply return to the Guess Schema section of the wizard, and add a second column by clicking the + button. We should take a moment here to double check that the 'Skip Header Rows' parameter is set to 0 to prevent any of our data being misinterpreted as a header row. Next, in the lower-right panel, we select each field under 'Name' and name the two columns something more appropriate. In this case, we have a column called "state" and a column called "airport code".

 

Returning to the Test, the Cloud Storage Load Generator will update the sample table with our new properties. Our test result provides us with a sample two-column table, just like we wanted. The columns are labelled appropriately and we can now go on to use this table with other Matillion ETL for BigQuery jobs and components.

 

 

Clicking 'OK' will return users to the job interface and create two linked components: Create/Replace Table and Load. Each component is parameterised by the Cloud Storage Load Generator and can be run as a job by linking to a Start component.