Azure Blob Storage

Load Parquet, CSV, JSON and Avro files from an Azure storage container into warehouse tables, and keep them current as new files arrive.

Azure Blob Storage is in beta. Point Contrast at a location in a container, 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.

Before you connect

You need the container URL, such as https://account.blob.core.windows.net/container/path. A Data Lake Storage path (abfss://container@account.dfs.core.windows.net/path) works too and is saved as its blob URL. Contrast lists and reads blobs under that path only. It never writes or deletes a blob.

Contrast can read as a service principal (recommended), with a SAS token, or with the storage account key.

Service principal

  1. In Microsoft Entra ID, register an app for Contrast and create a client secret under Certificates & secrets.

  2. In the container's Access control (IAM), assign the app the Storage Blob Data Reader role. Assign it at the container, not the storage account or subscription, so other containers stay out of reach. Or run:

    az role assignment create \
      --assignee <client-id> \
      --role "Storage Blob Data Reader" \
      --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<account>/blobServices/default/containers/<container>"
  3. Paste the directory (tenant) ID and application (client) ID from the app's Overview, and the client secret's value (not its ID).

Role assignments can take a few minutes to apply.

SAS token

A SAS stops working when it expires, and syncs stop with it, so prefer a service principal for a connection that keeps running. If you use a SAS, create one for the container that allows Read (r) and List (l) and nothing else. Paste the token, with or without its leading ?, or the whole SAS URL. Paste it into the SAS field, never into the container URL: Contrast refuses a container URL with a query string.

A user delegation SAS is signed with your Microsoft Entra sign-in. Azure limits it to 7 days, whatever expiry you set:

az storage container generate-sas \
  --account-name <account> \
  --name <container> \
  --permissions rl \
  --expiry <YYYY-MM-DD> \
  --auth-mode login --as-user

A SAS signed with the storage account key can have a later expiry. Revoking it before then means rotating the account key it was signed with:

az storage container generate-sas \
  --account-name <account> \
  --name <container> \
  --permissions rl \
  --expiry <YYYY-MM-DD> \
  --account-key <account-key>

When the token expires, open the source and choose Edit connection, then replace the token.

Account key

Copy key1 or key2 from the storage account's Access keys page. An account key can read and change everything in the storage account, so prefer a service principal or a SAS, and rotate the key if you use it.

Connect

You need to be a workspace administrator to start a sync. Editors can connect the container.

  1. Open the Azure Blob Storage setup link.
  2. Enter the container URL, choose how Contrast signs in, and finish the steps above.
  3. Add a dataset for each group of files, or select Suggest datasets to start from proposals. Select Preview on a dataset to check it before you save. See Datasets.
  4. Select the datasets to sync and start the sync.

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.

Datasets

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.

SettingWhat it does
NameThe table name: lowercase letters, digits and underscores, starting with a letter, at most 63 characters.
PatternWhich 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/.
FormatParquet, CSV, JSON or Avro.
CompressionFor CSV and JSON: from the file extension (the default), none, gzip, Zstandard or bzip2. Parquet and Avro files carry their own compression.
CSV optionsDelimiter, 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 layoutDetect (the default), one object per line, or one array per file.
Row keysFile 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 dataKeep 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.
LookbackHow 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.

Preview a dataset

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:

  • The files the pattern matched: the first 20 in key order, and how many match in all.
  • When nothing matches, the nearest files that almost did, so you can see what to change in the pattern.
  • The columns Contrast inferred.
  • The sample rows.
  • Warnings: files with different schemas, values that don't fit and would go to _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.

Suggest datasets

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.

Edit datasets later

You can change a connected container'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.

  • Add a dataset. Saving adds its table, and the next sync loads it from every matching file. If the files can't load yet, for example because they have more than 1,000 columns, the table is saved without syncing and the app says why. Each sync checks it again.
  • Change a saved dataset's pattern, format, compression or options. This requires a full resync of that table, because the rows already loaded were read under the old settings. The app tells you which tables will reload from every file and asks you to confirm before it saves. Only those tables reload. When several change, one sync reloads them and reads only new files for the other tables.
  • Remove a dataset. Its table stops syncing. The rows already loaded and the table's file history stay. To resume the table from where it stopped, add a dataset with the same name back. If it comes back with a different pattern, format, compression or options, the table is resynced as for any such change.
  • Row keys can't change after a dataset's table is created. A resync merges the reread rows by key and keeps every row it touches, so rows loaded under the old keys would stay. To key rows differently, add a new dataset with the new row keys, then remove the old one.
  • Rename a dataset. A rename removes the old dataset and adds a new one: the old table stops syncing and keeps its rows, and a table with the new name loads from every matching file. The app asks you to confirm before it saves a removal or a rename.
  • If someone else changed the datasets while you were editing, the save is refused. Reload and edit again.

Columns Contrast adds

Every table has these columns besides the file's own:

ColumnTypeContents
_row_idstringA hash of the file's key and the row number. The primary key when rows are keyed by file and row number.
_file_pathstringThe file's key in the container
_file_row_numberlongThe row's position in its file, counting from 0
_file_last_modifiedtimestamp with time zoneWhen the file's content was written
_rescued_datastringValues 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.

How new files are found

Each sync lists everything under the dataset's part of the location and loads the files it hasn't recorded yet.

  • Any key order. Files don't need names that sort after the last one loaded. A file whose name sorts first still loads.
  • One load per path. Once a file has loaded, a new upload to the same path is recorded as an ignored overwrite and is not read. To load changed data, write it to a new path. A renamed or moved file is a new path and loads again.
  • Failed files. A file that failed is read again only when its contents change. See File history.
  • Deleted files. Rows stay in the table after their file is deleted.
  • Lookback. A sync reads files whose timestamp falls after the previous sync's cutoff minus the lookback. Some uploads carry the time they started, and copied files can keep their original time, so a file can arrive with a timestamp the last sync already passed. A file older than the lookback allows is only picked up by a full resync.
  • Skipped without a record. Folder markers, empty (zero-byte) files, and paths with a folder or file name that starts with _ or ..

Contrast finds files by listing on each scheduled sync. It does not use event notifications.

File history

Open a table's Files view to see each file Contrast has recorded for it, newest first. Each file has one status:

StatusMeaning
LoadedThe file's rows were loaded.
FailedThe file couldn't be read. The record shows its first error.
SkippedThe file couldn't be read as listed: it is in an archive storage class, or it was deleted or overwritten while being read. It is read again when its contents change, and an archived file is read by the next sync after you restore it.
Ignored overwriteThe 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.

Bad files and bad values

  • A value that doesn't fit its column, such as text in a number column, is set to null and kept in _rescued_data with the reason, when the dataset keeps rows. Values are never truncated.
  • Nested values (structs, lists and maps, or JSON objects and arrays) land as JSON text.
  • Decimals with more than 38 digits and timestamps with nanosecond precision are rescued, not rounded.
  • New columns are added as nullable, and a column missing from a file reads as null. Integers widen to longs, floats to doubles, and decimals to wider decimals. Any other type change leaves the table's column as it is and rescues the values.
  • With key columns, a row whose key is null or missing is not loaded and is counted on its file's record.
  • A file that can't be parsed at all is recorded as failed with its first error, and the table carries on with other files unless the dataset stops the sync on bad data.

Limits in beta

  • New files are found by listing the location on each scheduled sync: every 15 minutes by default, and never more often. Event Grid notifications are not used.
  • Column types come from the first files read. A number column inferred from whole numbers stays a whole-number column: fractional values that arrive later are set to null and kept in _rescued_data rather than widening the column. If a column can hold fractions, make sure the first file has one, or expect rescued values.
  • A file is loaded once per path. Overwriting a file does not reload it.
  • Deleting a file doesn't remove its rows. Only a full resync drops the rows of files that are gone. If a resync would remove more than a fifth of a table's rows (and more than 25), or all of them, Contrast keeps those rows until a workspace editor or administrator approves the deletion. A full resync that couldn't read every file removes nothing, so the rows of an archived or failed file are never dropped by mistake; the table says so, and the next full resync that reads every file removes the rows of deleted files.
  • A table can have at most 1,000 columns besides the ones Contrast adds.
  • Each sync lists every file under the dataset's folder. Datasets of up to about a million files have been tested; larger ones take longer to list on every sync.
  • Blobs in the Archive tier are listed but can't be read until you rehydrate them. The next sync after rehydration loads them.
  • Formats are Parquet, CSV, JSON and Avro. ORC and XML are not supported.
  • Lookback is at most 720 hours.

Troubleshooting

Sync errors name one of these codes.

CodeWhat to do
object_storage_invalid_locationEnter the container URL as https://account.blob.core.windows.net/container/path, without a query string or . or .. folders.
object_storage_invalid_credentialsThe tenant ID, client ID, SAS token or account key is incomplete or malformed. Paste it again.
object_storage_auth_failedAzure rejected the credentials. Check the client secret or SAS hasn't expired and the account key hasn't been rotated.
object_storage_access_deniedThe error names the action that was denied, list or read. Assign Storage Blob Data Reader on the container, or create a SAS with Read and List.
object_storage_bucket_not_foundCheck the storage account and container names.
object_storage_object_archivedThe blob is in the Archive tier. Rehydrate it to the Hot or Cool tier; the next sync loads it.
object_storage_object_goneThe file was deleted between listing and reading. It is recorded as skipped and the table carries on.
object_storage_object_changedThe 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_rowsA 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_throttledThe provider limited request rates. The sync retries.
object_storage_unavailableThe provider timed out or returned a server error. The sync retries.
object_storage_too_many_columnsThe 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_missingThe 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_rescuedValues 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_missingShown 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_invalidThe 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_crashedContrast 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 Microsoft's documentation on assigning a role for blob data and SAS tokens.