Load Parquet, CSV, JSON and Avro files from a Cloud Storage bucket into warehouse tables, and keep them current as new files arrive.
Google Cloud Storage is in beta. Point Contrast at a location in a bucket, describe the files to load, and each group of files becomes a warehouse table. Every sync loads the files that arrived since the last one.
You need the location (gs://bucket/path). Contrast lists and reads objects under that path only. It never writes or deletes an object.
Contrast can read as your workspace's own Google service account (recommended) or with a service account key.
Each Contrast workspace has a Google service account. There is no key to paste, store or rotate.
In the connect form, choose Contrast service account. The form shows the service account's email with a copy button.
In the Cloud console, open Cloud Storage → Buckets → your bucket → Permissions → Grant access. Add the email as a principal with the role Storage Object Viewer (roles/storage.objectViewer). Or run:
gcloud storage buckets add-iam-policy-binding gs://lake-bucket \
--member=serviceAccount:<email from the form> \
--role=roles/storage.objectViewerStorage Object Viewer lets Contrast list and read objects in the bucket and nothing else. To revoke access, remove the role binding.
A bucket encrypted with a customer-managed encryption key (CMEK) needs nothing more. Cloud Storage's own service agent decrypts the objects for any reader with Storage Object Viewer, so don't grant Contrast or your service account a Cloud KMS role. The service agent must keep its access to the key: if the key is disabled or the agent loses access, reads fail with object_storage_access_denied and the action decrypt.
If the form says the workspace service account isn't available, connect with a service account key instead.
Grant one of your service accounts Storage Object Viewer on the bucket, create a JSON key for it under IAM → Service accounts → Keys, and paste the whole key file into the form.
You need to be a workspace administrator to start a sync. Editors can connect the bucket.
When you connect, Contrast checks that it can sign in, list the location and read a file. Credentials are stored encrypted and are never shown again.
A dataset is one table, files.<name>, loaded from the files its pattern matches. Start with one and add more for other file groups in the same location. The same file can belong to two datasets, and each loads it separately.
| Setting | What it does |
|---|---|
| Name | The table name: lowercase letters, digits and underscores, starting with a letter, at most 63 characters. |
| Pattern | Which files belong to the table, relative to the location. * and ? match within one folder, ** matches across folders, and {a,b} and [a-z] match a set. events/**/*.parquet matches every Parquet file at any depth under events/. |
| Format | Parquet, CSV, JSON or Avro. |
| Compression | For CSV and JSON: from the file extension (the default), none, gzip, Zstandard or bzip2. Parquet and Avro files carry their own compression. |
| CSV options | Delimiter, whether the first row holds column names, quote character, escape character (by default a doubled quote reads as one quote), null values, encoding, rows to skip before the header, and a comment character. |
| JSON layout | Detect (the default), one object per line, or one array per file. |
| Row keys | File and row number (the default) keeps every row of every file. Key columns merges rows by the columns you name, so a later row replaces an earlier one with the same key. |
| When a file has bad data | Keep the row (the default) loads the row and moves values that don't fit to _rescued_data. Skip the file stops loading a file at its first bad value and records it as failed; rows already saved from earlier parts of a large file stay in the table. Stop the sync stops the table's sync at the first bad value. |
| Lookback | How far behind the last sync a file's timestamp can be and still load: 1 to 720 hours, 168 (a week) by default. See How new files are found. |
The connect form says in plain words what each pattern matches. Contrast skips paths with a folder or file name that starts with _ or . (such as _SUCCESS, _temporary/ and .crc files), so a pattern that names one matches nothing.
Select Preview on a dataset to see what it would load before you save it. Contrast lists up to 10,000 objects under the location and reads up to 32 MB for at most 20 seconds. It samples up to 3 matching files and shows up to 20 rows. The preview shows:
_rescued_data, a Delta or Iceberg table under the location, and a note when a limit cut the preview short.A preview reads files but loads nothing and creates no table.
Select Suggest datasets on the location to have Contrast look at what is there. It groups files by their leading folders and file extension and proposes up to 50 datasets, each with a pattern and format. Keep the ones you want, change them as needed, and preview them like any other dataset.
You can change a connected bucket's datasets after the first save. You need to be a workspace administrator to do this. The location stays the one you connected, and every pattern is read under it. To read another location, connect it as a new source.
Every table has these columns besides the file's own:
| Column | Type | Contents |
|---|---|---|
_row_id | string | A hash of the file's key and the row number. The primary key when rows are keyed by file and row number. |
_file_path | string | The file's key in the bucket |
_file_row_number | long | The row's position in its file, counting from 0 |
_file_last_modified | timestamp with time zone | When the file's content was written |
_rescued_data | string | Values that didn't fit, as JSON text with the reason; null for clean rows |
A data column whose name matches one of these is renamed with a data_ prefix. Folder names in the form key=value under a dataset become string columns.
Each sync lists everything under the dataset's part of the location and loads the files it hasn't recorded yet.
_ or ..Contrast finds files by listing on each scheduled sync. It does not use event notifications.
Open a table's Files view to see each file Contrast has recorded for it, newest first. Each file has one status:
| Status | Meaning |
|---|---|
| Loaded | The file's rows were loaded. |
| Failed | The file couldn't be read. The record shows its first error. |
| Skipped | The file couldn't be read as listed: it was deleted or overwritten while being read. It is read again when its contents change. |
| Ignored overwrite | The path had already loaded, so the new upload was not read. |
Select Failed only to show just the files that failed. A failed file is read again only when its contents change. After you fix the cause, such as the format settings, upload a corrected file to a new path.
_rescued_data with the reason, when the dataset keeps rows. Values are never truncated._rescued_data rather than widening the column. If a column can hold fractions, make sure the first file has one, or expect rescued values.Sync errors name one of these codes.
| Code | What to do |
|---|---|
object_storage_invalid_location | Enter the location as gs://bucket/path, without . or .. folders. |
object_storage_invalid_credentials | The key file is incomplete or isn't a service account key. Download a new JSON key and paste the whole file. |
object_storage_auth_failed | Google rejected the service account. Check the key hasn't been deleted or disabled. |
object_storage_access_denied | The error names the action that was denied. For list or read, grant Storage Object Viewer on the bucket to the service account shown in the form or in the key file. For decrypt, the bucket's customer-managed key is disabled or Cloud Storage's service agent can't use it: grant the service agent Cloud KMS CryptoKey Encrypter/Decrypter on the key. Contrast's account needs no KMS role. |
object_storage_bucket_not_found | Check the bucket name. |
object_storage_object_gone | The file was deleted between listing and reading. It is recorded as skipped and the table carries on. |
object_storage_object_changed | The file was overwritten while it was read. If no rows from it were saved yet, it is recorded as skipped; otherwise it is recorded as failed and the rows already saved from it stay. |
object_storage_resync_kept_rows | A full resync couldn't read every file (one was archived, failed, or changed while it was read), so it removed no rows. Fix or restore the file, then run the full resync again to drop the rows of deleted files. |
object_storage_throttled | The provider limited request rates. The sync retries. |
object_storage_unavailable | The provider timed out or returned a server error. The sync retries. |
object_storage_too_many_columns | The dataset's files, or a new file joining it, would give the table more than 1,000 columns. A new table isn't created and a new file is recorded as failed (or stops the sync, if the dataset stops on bad data). Narrow the pattern to files with fewer columns, or split the files into datasets with their own patterns. |
object_storage_identity_columns_missing | The dataset's key columns aren't in its files, so the table can't sync yet. Check the key column names against the preview's columns, add a file that has them, or key rows by file and row number. |
object_storage_rows_rescued | Values didn't fit the table's columns in a dataset that skips the file or stops the sync on bad data. With Skip the file the file is recorded as failed; with Stop the sync the sync stops. Fix the values and upload the file to a new path, or switch the dataset to Keep the row to load such rows with the values in _rescued_data. |
object_storage_key_missing | Shown on a loaded file's record: some rows had no value for a key column and weren't loaded. The file's other rows loaded. Fill in the key values and upload the file to a new path, or choose key columns every row has. |
object_storage_file_invalid | The file can't be parsed as the dataset's format. Check the format, compression and CSV or JSON options, or fix the file and upload it to a new path. |
object_storage_reader_memory_exceeded, object_storage_reader_timeout, object_storage_reader_crashed | Contrast reads each file in an isolated process with a memory and time limit. A timeout or crash is tried again; after three failures in a row at the same place the file is recorded as failed. Split very large files, row groups or lines, then upload them to a new path. |
See Google's documentation on Cloud Storage IAM roles.