# Databricks Delta Lake on AWS (v1) Data Loading Reference

Learn how Stitch will load data from your integrations into Stitch’s Databricks Delta Lake on AWS destination.

In this guide, we’ll cover data loading scenarios involving:

* [Primary key columns](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#primary-key-scenarios)

* [Replication keys and how data is loaded as a result](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#replication-key-scenarios)

* [Object identifiers in the destination, including naming limitations and transformations](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#object-name-scenarios)

* [Table creation and modification in the destination](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#table-name-scenarios)

* [Various data types, including how data is typed and structured in the destination](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#data-typing-scenarios)

* [Schema changes in the source or structural changes in the destination](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#schema-change-scenarios)

* [Modifications made to the destination, such as the application of workload/performance management features or user privilege changes](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#destination-change-scenarios)

## Primary Key scenarios

Scenarios involving Primary Key columns.

A table without a Primary Key is replicated.

| **IF** | A table without a Primary Key is replicated. |
| --- | --- |
| **THEN** | <ul> <li><strong>Initial job</strong>: Table is created.</li> <li> <p><strong>Subsequent jobs</strong>: If using Key-based Incremental or Log-based Incremental Replication, records will be added to the table in an Append-Only fashion.</p> <p>If using Full Table Replication, the table will be overwritten in its entirety during each job.</p> </li></ul> |

A table with a single Primary Key is replicated.

| **IF** | A table with a single Primary Key is replicated. |
| --- | --- |
| **THEN** | <ul> <li><strong>Initial job:</strong> Table is created with a <a href="https://help.qlik.com/en-US/stitch/destinations/databricks-delta/reference#replication--primary-keys">table property comment</a> containing the Primary Key information for the table.</li> <li> <p><strong>Subsequent jobs:</strong> If using Key-based Incremental or Log-based Incremental Replication, data will be de-duped based on the Primary Key column and upserted into the table.</p> <p>If using Full Table Replication, the table will be overwritten in its entirety during each job.</p> </li></ul> |

A table with multiple Primary Keys is replicated.

| **IF** | A table with multiple Primary Keys is replicated. |
| --- | --- |
| **THEN** | <ul> <li><strong>Initial job:</strong> Table is created with a <a href="https://help.qlik.com/en-US/stitch/destinations/databricks-delta/reference#replication--primary-keys">table property comment</a> containing the Primary Key information for the table.</li> <li> <p><strong>Subsequent jobs:</strong> If using Key-based Incremental or Log-based Incremental Replication, data will be de-duped based on the Primary Key column and upserted into the table.</p> <p>If using Full Table Replication, the table will be overwritten in its entirety during each job.</p> </li></ul> |

The table's Primary Key(s) is/are changed.

| **IF** | The table’s Primary Key(s) is/are changed. |
| --- | --- |
| **THEN** | Changing a table’s Primary Key(s) is only permitted if the table is using Full Table Replication.<br><br>If Primary Key columns are changed for a table using Key-based or Log-based Incremental Replication, Stitch will stop processing data for the table. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>incoming pks([new_pk_column(s)]) do not match pks([original_pk_column(s)]) in existing table([table_name])<br>```<br><br>`incoming pks([new_pk_column(s)]) do not match pks([original_pk_column(s)]) in existing table([table_name])`incoming pks([([new\_pk\_column((s)]))]) do do not match pks([([original\_pk\_column((s)]))]) in in existing table([([table\_name])) |
| **FIX IT** | For tables using Key-based or Log-based Incremental Replication:<br><br><ul> <li>Re-instate the table’s Primary Key(s) to allow Stitch to continue processing data for the table, or</li> <li> <p>Drop the table in Databricks Delta and then reset the table in Stitch. This will re-create the table using the new Primary Keys and allow loading to continue.</p> <p><strong>Note</strong>: Resetting the table will queue a full re-replication of the table’s data.</p> </li></ul> |

A Primary Key column in a source contains multiple data types.

| **IF** | A Primary Key column in a source contains multiple data types. |
| --- | --- |
| **THEN** | To accommodate data of varying types, Stitch will create multiple columns to ensure data is loaded with the correct type. In the destination, this will look like the column has been “split”. To ensure data is loaded correctly, a Primary Key column may only a single data type.<br><br>For example: Stitch initially detected `INTEGER` values for an `id` column, but during a subsequent replication job, detected `STRING` values. All `INTEGER` values will be placed in the original `id` column, and a new `id__st` column will be created to accommodate the `STRING` values. In Databricks Delta, the table might look like this:<br><br><table> <thead> <tr> <th>id</th> <th>id__st</th> <th>name</th> </tr> </thead>  <tr> <td>1</td> <td>&nbsp;</td> <td>Finn</td> </tr> <tr> <td>&nbsp;</td> <td>“2”</td> <td>Jake</td> </tr> </table><br><br>Column splits will result in `NULL` values in the `id` column. As Primary Key columns can’t contain `NULL` values, this will result in the error below. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>missing pk([pk_column]) from updated record<br>```<br><br>`missing pk([pk_column]) from updated record`missing pk([([pk\_column])) from updated record |
| **FIX IT** | Verify the data type(s) for the Primary Key column in the source. If it contains multiple data types, you’ll need to ensure that the column only contains values of one data type.<br><br>**Note**: If the table is using Key-based or Log-based Incremental Replication, you’ll also need to do the following:<br><br><ol> <li>Drop the table in Databricks Delta</li> <li>Reset the table in Stitch. This will queue a full re-replication of the table’s data, and re-create the table in Databricks Delta with the correct data type for the Primary Key column.</li></ol> |

You remove the Primary Key column(s) for a table in Databricks Delta.

| **IF** | You remove the Primary Key column(s) for a table in Databricks Delta. |
| --- | --- |
| **THEN** | Changing a table’s Primary Key(s) is not permitted in Databricks Delta.<br><br>If Primary Key columns are changed, Stitch will stop processing data for the table. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>incoming pks([new_pk_column(s)]) do not match pks([original_pk_column(s)]) in existing table([table_name])<br>```<br><br>`incoming pks([new_pk_column(s)]) do not match pks([original_pk_column(s)]) in existing table([table_name])`incoming pks([([new\_pk\_column((s)]))]) do do not match pks([([original\_pk\_column((s)]))]) in in existing table([([table\_name])) |
| **FIX IT** | For tables using Key-based or Log-based Incremental Replication:<br><br><ul> <li>Re-instate the table’s Primary Key(s) to allow Stitch to continue processing data for the table, or</li> <li> <p>Drop the table in Databricks Delta and then reset the table in Stitch. This will re-create the table using the new Primary Keys and allow loading to continue.</p> <p><strong>Note</strong>: Resetting the table will queue a full re-replication of the table’s data.</p> </li></ul> |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)

## Replication Key scenarios

Scenarios involving Replication Keys and how data is loaded as a result.

A table using Key-based Incremental Replication is replicated where the Replication Key column contains NULL values.

| **IF** | A table using Key-based Incremental Replication is replicated where the Replication Key column contains `NULL` values. |
| --- | --- |
| **THEN** | <ul> <li><strong>During the initial job</strong>, the table will be created and all rows will be replicated.</li> <li><strong>During subsequent jobs</strong>, only rows with populated Replication Keys will be replicated and persisted to Databricks Delta.</li></ul> |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)

## Object naming scenarios

Scenarios involving object identifiers in the destination, including naming limitations and transformations.

A table name contains more characters than allowed by Databricks Delta.

| **IF** | A table name contains more characters than allowed by Databricks Delta. |
| --- | --- |
| **THEN** | Databricks Delta will reject all data for the table. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>table name ([table_name]) is too long ([table_name_length]) for databricks delta max identifier length of 78 characters<br>```<br><br>`table name ([table_name]) is too long ([table_name_length]) for databricks delta max identifier length of 78 characters`table name ([([table\_name])) is too long ([([table\_name\_length])) for for databricks delta max identifier length of 78 characters<br><br><br>Rejected records will be logged in the `_sdc_rejected` table of the integration's schema. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table). |
| **FIX IT** | If possible, change the table name in the source to be less than Databricks Delta’s character limit of 78 characters.<br><br><br>Use the [`_sdc_rejected` table](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table) to identify the root of the issue. |

A column name contains more characters than allowed by Databricks Delta.

| **IF** | A column name contains more characters than allowed by Databricks Delta. |
| --- | --- |
| **THEN** | Databricks Delta will reject columns with names that exceed the column character limit. Other columns in the table will persist to Databricks Delta. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>column name ([column_name]) is too long ([column_name_limit]<br>```<br><br>`column name ([column_name]) is too long ([column_name_limit]`column name ([([column\_name])) is too long ([([column\_name\_limit]<br><br><br>Rejected records will be logged in the `_sdc_rejected` table of the integration's schema. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table). |
| **FIX IT** | If possible, change the column name in the source to be less than Databricks Delta’s character limit of 122 characters.<br><br><br>Use the [`_sdc_rejected` table](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table) to identify the root of the issue. |

Two columns are replicated that canonicalize to the same name.

| **IF** | Two columns are replicated that canonicalize to the same name. |
| --- | --- |
| **THEN** | For example: A table containing both `CustomerId` and `customerid` columns.<br><br>Databricks Delta will reject the records and create a log for the rejected records in the `_sdc_rejected` table in that integration’s schema. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>Field collision on [COLUMN_NAME]<br>```<br><br>`Field collision on [COLUMN_NAME]`Field collision on [[COLUMN\_NAME]<br><br><br>Rejected records will be logged in the `_sdc_rejected` table of the integration's schema. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table). |
| **FIX IT** | If possible, re-name one of the columns in the source so that both column names will be unique when replicated to Databricks Delta.<br><br><br>Use the [`_sdc_rejected` table](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table) to identify the root of the issue. |

A column is replicated that has a mixed-case name.

| **IF** | A column is replicated that has a mixed-case name. |
| --- | --- |
| **THEN** | Databricks Delta will convert letters to lowercase. For example:<br><br><table> <thead> <tr> <th>Columns in source</th> <th>Columns in Databricks Delta</th> </tr> </thead>  <tr> <td><code>CuStOmErId</code></td> <td><code>customerid</code></td> </tr> <tr> <td><code>customerID</code></td> <td><code>customerid</code></td> </tr> <tr> <td><code>customerid</code></td> <td><code>customerid</code></td> </tr> </table> |

A column is replicated that has a name with spaces.

| **IF** | A column is replicated that has a name with spaces. |
| --- | --- |
| **THEN** | Databricks Delta will convert spaces to underscores. For example:<br><br><table> <thead> <tr> <th>Columns in source</th> <th>Columns in Databricks Delta</th> </tr> </thead>  <tr> <td><code>customer id</code></td> <td><code>customer_id</code></td> </tr> <tr> <td><code>CUSTOMER ID</code></td> <td><code>customer_id</code></td> </tr> </table> |

A column is replicated with a name that contains unsupported special characters.

| **IF** | A column is replicated with a name that contains unsupported special characters. |
| --- | --- |
| **THEN** | Databricks Delta will convert special characters to underscores. For example:<br><br><table> <thead> <tr> <th>Columns in source</th> <th>&nbsp;</th> <th>Columns in Databricks Delta</th> </tr> </thead>  <tr> <td><code>!CUSTOMERID</code></td> <td>&nbsp;</td> <td><code>_customerid</code></td> </tr> <tr> <td><code>CUSTOMER!ID</code></td> <td>&nbsp;</td> <td><code>customer_id</code></td> </tr> </table> |

A column is replicated with a name that begins with a non-letter.

| **IF** | A column is replicated with a name that begins with a non-letter. |
| --- | --- |
| **THEN** | Databricks Delta will conserve the non-letter characters and prefix the name with an underscore. For example:<br><br><table> <thead> <tr> <th>Columns in source</th> <th>&nbsp;</th> <th>Columns in Databricks Delta</th> </tr> </thead>  <tr> <td><code>123customerid</code></td> <td>&nbsp;</td> <td><code>_123customerid</code></td> </tr> <tr> <td><code>_987CUSTOMERID</code></td> <td>&nbsp;</td> <td><code>_987customerid</code></td> </tr> </table> |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)

## Table scenarios

Scenarios involving table creation and modification in the destination.

A table contains entirely NULL columns.

| **IF** | A table contains entirely `NULL` columns. |
| --- | --- |
| **THEN** | No table is created in Databricks Delta. At least one column must have a non-`NULL` value for Stitch to create a table in Databricks Delta. |

A table arrives with more columns than Databricks Delta allows.

| **IF** | A table arrives with more columns than Databricks Delta allows. |
| --- | --- |
| **THEN** | Databricks Delta doesn’t have a column limit for tables. Data will continue to load. |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)

## Data typing scenarios

Scenarios involving various data types, including how data is typed and structured in the destination.

Stitch detects multiple data types for a single column.

| **IF** | Stitch detects multiple data types for a single column. |
| --- | --- |
| **THEN** | To accommodate data of varying types, Stitch will create multiple columns to ensure data is loaded with the correct type. In the destination, this will look like the column has been “split”.<br><br>For example: Stitch first detected that `order_confirmed` contained `BOOLEAN` data, but during a subsequent job, detected `STRING` values. To accommodate data of varying types, Stitch will:<br><br><ol> <li> <p>Store data for the original data type in the original column. In this example, only <code>BOOLEAN</code> values will be stored in <code>order_confirmed</code>. The name of the original column will not change.</p> </li> <li> <p>Create additional columns to store the other data types - one for each data type detected - and append the data type to the column name. In this example, a <code>order_confirmed__st</code> column will be created to store <code>STRING</code> values.</p> </li></ol><br><br>**Note**: If the column is used as a Primary Key for the table, this scenario will result in a loading error. Refer to the [Primary Key scenarios](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#primary-key-scenarios) section for more info and examples. |

Data is replicated to Databricks Delta that is nested, containing many top-level properties and potentially nested sub-properties.

| **IF** | Data is replicated to Databricks Delta that is nested, containing many top-level properties and potentially nested sub-properties. |
| --- | --- |
| **THEN** | Nested data structures (JSON arrays and objects) will be loaded intact into a `STRING` column with a comment specifying that the column contains JSON. |

A VARCHAR column is replicated to Databricks Delta.

| **IF** | A `VARCHAR` column is replicated to Databricks Delta. |
| --- | --- |
| **THEN** | Databricks Delta will store `VARCHAR` data as `STRING`. |

VARCHAR data is loaded that exceeds the current maximum size for the column.

| **IF** | `VARCHAR` data is loaded that exceeds the current maximum size for the column. |
| --- | --- |
| **THEN** | No widening will occur. |

A column containing date data with timezone info is replicated to Databricks Delta.

| **IF** | A column containing date data with timezone info is replicated to Databricks Delta. |
| --- | --- |
| **THEN** | Databricks Delta will store the value as `TIMESTAMP WITH TIMEZONE`. In Databricks Delta, this data is stored with timezone information and expressed as UTC. |

A column contains timestamp data that is outside Databricks Delta's supported range.

| **IF** | A column contains timestamp data that is outside Databricks Delta’s supported range. |
| --- | --- |
| **THEN** | Databricks Delta will reject the records that fall outside the supported range. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>timestamp ([timestamp]) out of range for column [column_name]<br>```<br><br>`timestamp ([timestamp]) out of range for column [column_name]`timestamp ([([timestamp])) out of range for for column [[column\_name]<br><br><br>Rejected records will be logged in the `_sdc_rejected` table of the integration's schema. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table). |
| **FIX IT** | To resolve the error, offending values in the source must be changed to be within Databricks Delta’s timestamp range.<br><br><br>Use the [`_sdc_rejected` table](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table) to identify the root of the issue. |

A column contains integer data.

| **IF** | A column contains integer data. |
| --- | --- |
| **THEN** | Databricks Delta will store integer data as `BIGINT`. |

A column contains integer data that is outside Databricks Delta's supported range.

| **IF** | A column contains integer data that is outside Databricks Delta’s supported range. |
| --- | --- |
| **THEN** | Databricks Delta will reject the records that fall outside the supported range. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>long ([long]) out of range for column [column_name]<br>```<br><br>`long ([long]) out of range for column [column_name]`long ([([long])) out of range for for column [[column\_name]<br><br><br>Rejected records will be logged in the `_sdc_rejected` table of the integration's schema. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table). |
| **FIX IT** | To resolve the error, offending values in the source must be changed to be within Databricks Delta’s limit for integers.<br><br><br>Use the [`_sdc_rejected` table](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table) to identify the root of the issue. |

A column contains decimal data.

| **IF** | A column contains decimal data. |
| --- | --- |
| **THEN** | Databricks Delta will store decimal data as `DECIMAL(38,6)`. |

A column contains decimal data that is outside Databricks Delta's supported range.

| **IF** | A column contains decimal data that is outside Databricks Delta’s supported range. |
| --- | --- |
| **THEN** | Databricks Delta will reject the records that fall outside the supported range. |
| **AND** | The following error will display in the **Notifications** tab in Stitch:<br><br>```<br>decimal ([decimal]) out of range for column [column_name]<br>```<br><br>`decimal ([decimal]) out of range for column [column_name]`decimal ([([decimal])) out of range for for column [[column\_name]<br><br><br>Rejected records will be logged in the `_sdc_rejected` table of the integration's schema. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table). |
| **FIX IT** | To resolve the error, offending values in the source must be changed to be within Databricks Delta’s limit for decimals.<br><br><br>Use the [`_sdc_rejected` table](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table) to identify the root of the issue. |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)

## Schema change scenarios

Scenarios involving schema changes in the source or structural changes in the destination.

A new column is added in table already set to replicate.

| **IF** | A new column is added in table already set to replicate. |
| --- | --- |
| **THEN** | If the column has at least one non-`NULL` value in the source, the column will be created and appended to the end of the table in Databricks Delta.<br><br>**Note**: If the table using either Key- or Log-based Incremental Replication, backfilled values for the column will only be replicated if:<br><br><ol> <li>The records’ Replication Key values are greater than or equal to the last saved maximum Replication Key value for the table, or</li> <li>The table is reset and a historical re-replication is queued.</li></ol><br><br>Refer to [Tracking new columns in an already replicating table guide](https://help.qlik.com/en-US/stitch/replication/syncing-new-additional-columns#syncing-additional-columns-on-already-syncing-tables) for more info and examples. |

A new column is added by you to a Stitch-generated table in Databricks Delta.

| **IF** | A new column is added by you to a Stitch-generated table in Databricks Delta. |
| --- | --- |
| **THEN** | Columns may be added to tables created by Stitch as long as they are nullable, meaning columns don’t have `NOT NULL` constraints. |

A column is deleted at the source.

| **IF** | A column is deleted at the source. |
| --- | --- |
| **THEN** | How a deleted column is reflected in Databricks Delta depends on the Replication Method used by the table:<br><br><ul> <li> <p><strong>Key-based Incremental:</strong> The column will remain in the destination, and default <code>NULL</code> values will be placed in it going forward.</p> </li> <li> <p><strong>Log-based Incremental:</strong> Changes to a source table - including adding or removing columns, changing data types, etc. - require manual intervention before replication can continue. Refer to the <a href="https://help.qlik.com/en-US/stitch/replication/replication-methods/log-based-incremental#limitation-3--structural-changes">Log-based Incremental Replication documentation</a> for more info.</p> </li> <li> <p><strong>Full Table</strong>: The column will remain in the destination, and default <code>NULL</code> values will be placed in it going forward.</p> </li></ul> |

You remove a column from a Stitch-replicated table in your destination.

| **IF** | You remove a column from a Stitch-replicated table in your destination. |
| --- | --- |
| **THEN** | The result of deleting a column from a Stitch-generated table depends on the **type** of column being removed:<br><br><ul> <li> <p><strong>Primary Key columns</strong>: Changing a table’s Primary Key(s) is not permitted in Databricks Delta. If Primary Key columns are changed, Stitch will stop processing data for the table.</p> </li> <li> <p><strong>General columns</strong>:  If new data is detected for the removed column, Stitch will re-create it in Databricks Delta. This refers to all columns that are not prepended by <code>_sdc</code> or suffixed by a data type. For example: <code>customer_zip</code>, but not <code>customer_zip__st</code>.</p> <p><strong>Note</strong>: An integration must support selecting columns AND you must deselect the column in Stitch for the column removal to be permanent.</p> </li> <li> <p><strong>_sdc columns</strong>: Removing a Stitch replication column will prevent Stitch from loading replicated data into Databricks Delta.</p> </li> <li> <p><strong>Columns with data type suffixes</strong>: Removing a column created as result of accommodating <a href="https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#multiple-data-types">multiple data types</a> will prevent Stitch from loading replicated data into the table. This applies to columns with names such as: <code>customer_zip__st</code>, <code>customer_zip__int</code>, etc.</p> </li></ul> |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)

## Destination changes

Scenarios involving modifications made to the destination, such as the application of workload/performance management features or user privilege changes.

Partitioning is applied to Stitch-generated tables in the destination.

| **IF** | Partitioning is applied to Stitch-generated tables in the destination. |
| --- | --- |
| **THEN** | Stitch will respect the partitioning application. |

Clustering is applied to Stitch-generated tables in the destination.

| **IF** | Clustering is applied to Stitch-generated tables in the destination. |
| --- | --- |
| **THEN** | Stitch will respect the cluster application. |

[Back to top](https://help.qlik.com/en-US/stitch/replication/loading/destination-guides/databricks-delta#)