Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
<<<<<<< MagicBot/standardize-unioning-macros
# dbt_workday v1.0.0

[PR #32](https://github.com/fivetran/dbt_workday/pull/32) includes the following updates.

## Schema/Data Changes (--full-refresh required after upgrading)
**1 total change • 1 possible breaking change**

| Data Model(s) | Change type | Old | New | Notes |
| ------------- | ----------- | --- | --- | ----- |
| All models | `source_relation` column (when using a single workday schema) | Empty string (`''`) | `<database>.<schema>` | |

## Feature Updates
- Introduces the new (recommended) `workday_sources` variable for more robust union data configuration. The old `workday_union_schemas` and `workday_union_databases` variables will still be supported. See the [README](https://github.com/fivetran/dbt_workday/tree/main#define-database-and-schema-variables) for specific details.

## Under the Hood
- Adds the `fivetran_using_source_casing` variable for case-sensitive destination support. When enabled, downstream transformations respect source casing to ensure consistent results. See the [Additional Configurations](https://github.com/fivetran/dbt_workday/#source-casing-for-case-sensitive-destinations) section of the README for details.
- Introduces `fivetran_utils.partition_by_source_relation` to conditionally include `source_relation` in partition clauses only when multiple sources are configured.
=======
# dbt_workday v0.9.2

[PR #33](https://github.com/fivetran/dbt_workday/pull/33) includes the following update.

## Bug Fix
- Fixes an issue in `stg_workday__worker_history` where `annual_currency_summary_primary_compensation_basis`, `annual_currency_summary_total_base_pay`, and `annual_currency_summary_total_salary_and_allowances` could surface as strings instead of numeric values. These columns are now cast to float when the source type is a string.
>>>>>>> main

# dbt_workday v0.9.1

Expand Down
43 changes: 30 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Include the following Workday HCM package version in your `packages.yml` file:
```yml
packages:
- package: fivetran/workday
version: [">=0.9.0", "<0.10.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=1.0.0", "<1.1.0"] # we recommend using ranges to capture non-breaking changes automatically
```

#### Databricks dispatch configuration
Expand All @@ -78,31 +78,40 @@ dispatch:
```

### Define database and schema variables
#### Single connection
By default, this package runs using your destination and the `workday` schema. If this is not where your Workday HCM data is (for example, if your Workday HCM schema is named `workday_fivetran`), add the following configuration to your root `dbt_project.yml` file:
#### Option A: Single connection
By default, this package runs using your destination and the `workday` schema. If this is not where your Workday data is (for example, if your Workday schema is named `workday_fivetran`), add the following configuration to your root `dbt_project.yml` file:

```yml
# dbt_project.yml

vars:
workday_database: your_database_name
workday_database: your_destination_name
workday_schema: your_schema_name
```
#### Union multiple connections
If you have multiple Workday HCM connections in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. The package will union all of the data together and pass the unioned table into the transformations. You will be able to see which source it came from in the `source_relation` column of each model. To use this functionality, you will need to set either the `workday_union_schemas` OR `workday_union_databases` variables (cannot do both) in your root `dbt_project.yml` file:

#### Option B: Union multiple connections
If you have multiple Workday connections in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. For each source table, the package will union all of the data together and pass the unioned table into the transformations. The `source_relation` column in each model indicates the origin of each record.

To use this functionality, you will need to set the `workday_sources` variable in your root `dbt_project.yml` file:

```yml
# dbt_project.yml

vars:
workday_union_schemas: ['workday_usa','workday_canada'] # use this if the data is in different schemas/datasets of the same database/project
workday_union_databases: ['workday_usa','workday_canada'] # use this if the data is in different databases/projects but uses the same schema name
workday:
workday_sources:
- database: connection_1_destination_name # Required
schema: connection_1_schema_name # Required
name: connection_1_source_name # Required only if following the step in the following subsection

- database: connection_2_destination_name
schema: connection_2_schema_name
name: connection_2_source_name
```

> NOTE: The native `source.yml` connection set up in the package will not function when the union schema/database feature is utilized. Although the data will be correctly combined, you will not observe the sources linked to the package models in the Directed Acyclic Graph (DAG). This happens because the package includes only one defined `source.yml`.
> Previous versions of this package employed two separate, mutually exclusive variables for unioning: `workday_union_schemas` and `workday_union_databases`. While these variables are still supported, `workday_sources` is the recommended variable to configure.

To connect your multiple schema/database sources to the package models, follow the steps outlined in the [Union Data Defined Sources Configuration](https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#union_data-source) section of the Fivetran Utils documentation for the union_data macro. This will ensure a proper configuration and correct visualization of connections in the DAG.
#### Optional: Incorporate unioned sources into DAG

If you use [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt#transformationsfordbtcore) and are unioning multiple Workday connections, you can define your sources in a property `.yml` file, [using this as a template](https://github.com/fivetran/dbt_workday/blob/main/models/staging/src_workday.yml). Set the variable `has_defined_sources: true` under the Workday namespace in your `dbt_project.yml`. Otherwise, your Workday connections won't appear in your DAG. See the `union_connections` macro [documentation](https://github.com/fivetran/dbt_fivetran_utils/tree/releases/v0.4.latest#optional-union-connections-defined-sources-configuration) for full configuration details.

### (Optional) Utilizing Workday HCM History Mode

Expand Down Expand Up @@ -166,6 +175,14 @@ vars:
workday_<default_source_table_name>_identifier: your_table_name
```

#### Source casing for case-sensitive destinations
By default, the package applies case-insensitive comparisons when resolving `source_relation` values. If your destination is case-sensitive and you want downstream transformations to respect the exact casing of your source database and schema names, set the following variable:

```yml
vars:
fivetran_using_source_casing: true
```

### (Optional) Orchestrate your models with Fivetran Transformations for dbt Core™
<details><summary>Expand for details</summary>
<br>
Expand Down Expand Up @@ -199,4 +216,4 @@ We highly encourage and welcome contributions to this package. Learn how to cont

## Are there any resources available?
- If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_workday/issues/new/choose) section to find the right avenue of support for you.
- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).
- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'workday'
version: '0.9.2'
version: '1.0.0'
require-dbt-version: [">=1.3.0", "<3.0.0"]

models:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion integration_tests/ci/test_scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ test_scenarios:
- name: "employee history enabled"
vars:
employee_history_enabled: true
include_incremental: false
include_incremental: false

- name: "MDLS"
vars:
fivetran_using_source_casing: true
include_incremental: false
include_dbt_seed: true
4 changes: 2 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'workday_integration_tests'
version: '0.9.2'
version: '1.0.0'
config-version: 2

profile: 'integration_tests'
Expand Down Expand Up @@ -49,7 +49,7 @@ models:
seeds:
+docs:
show: false
+quote_columns: "{{ true if target.type in ('redshift', 'postgres') else false }}"
+quote_columns: "{{ target.type in ('postgres','redshift') or var('fivetran_using_source_casing', false) }}"
workday_integration_tests:
workday_country_personal_information_data:
+column_types:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='country_personal_information',
Expand All @@ -10,3 +12,15 @@
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='country_personal_information'
)
}}

{% endif %}
20 changes: 17 additions & 3 deletions models/staging/base/stg_workday__job_family_base.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='job_family',
database_variable='workday_database',
schema_variable='workday_schema',
table_identifier='job_family',
database_variable='workday_database',
schema_variable='workday_schema',
default_database=target.database,
default_schema='workday',
default_variable='job_family',
union_schema_variable='workday_union_schemas',
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='job_family'
)
}}

{% endif %}
20 changes: 17 additions & 3 deletions models/staging/base/stg_workday__job_family_group_base.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='job_family_group',
database_variable='workday_database',
schema_variable='workday_schema',
table_identifier='job_family_group',
database_variable='workday_database',
schema_variable='workday_schema',
default_database=target.database,
default_schema='workday',
default_variable='job_family_group',
union_schema_variable='workday_union_schemas',
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='job_family_group'
)
}}

{% endif %}
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='job_family_job_family_group',
database_variable='workday_database',
schema_variable='workday_schema',
table_identifier='job_family_job_family_group',
database_variable='workday_database',
schema_variable='workday_schema',
default_database=target.database,
default_schema='workday',
default_variable='job_family_job_family_group',
union_schema_variable='workday_union_schemas',
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='job_family_job_family_group'
)
}}

{% endif %}
20 changes: 17 additions & 3 deletions models/staging/base/stg_workday__job_family_job_profile_base.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='job_family_job_profile',
database_variable='workday_database',
schema_variable='workday_schema',
table_identifier='job_family_job_profile',
database_variable='workday_database',
schema_variable='workday_schema',
default_database=target.database,
default_schema='workday',
default_variable='job_family_job_profile',
union_schema_variable='workday_union_schemas',
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='job_family_job_profile'
)
}}

{% endif %}
20 changes: 17 additions & 3 deletions models/staging/base/stg_workday__job_profile_base.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='job_profile',
database_variable='workday_database',
schema_variable='workday_schema',
table_identifier='job_profile',
database_variable='workday_database',
schema_variable='workday_schema',
default_database=target.database,
default_schema='workday',
default_variable='job_profile',
union_schema_variable='workday_union_schemas',
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='job_profile'
)
}}

{% endif %}
14 changes: 14 additions & 0 deletions models/staging/base/stg_workday__military_service_base.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='military_service',
Expand All @@ -10,3 +12,15 @@
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='military_service'
)
}}

{% endif %}
20 changes: 17 additions & 3 deletions models/staging/base/stg_workday__organization_base.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{% if var('workday_union_schemas', []) | length > 0 or var('workday_union_databases', []) | length > 0 %}

{{
fivetran_utils.union_data(
table_identifier='organization',
database_variable='workday_database',
schema_variable='workday_schema',
table_identifier='organization',
database_variable='workday_database',
schema_variable='workday_schema',
default_database=target.database,
default_schema='workday',
default_variable='organization',
union_schema_variable='workday_union_schemas',
union_database_variable='workday_union_databases'
)
}}

{% else %}

{{
fivetran_utils.union_connections(
connection_dictionary='workday_sources',
single_source_name='workday',
single_table_name='organization'
)
}}

{% endif %}
Loading
Loading