Skip to content

pipeline delimiter not working in expect() block #219

@sangee14

Description

@sangee14

I am using the below code, where pipeline delimiter is being used with input_format as csv. Inside the expect() block, its not recognizing the delimiter and format, and throws the error,

{{ config(tags=['unit-test']) }}
{% set options = var('unit_tests_config') %}
{% call dbt_unit_testing.test('curr_table', 'stores users current data') %}
  {% call dbt_unit_testing.mock_ref('hub_table',options) %}
    users_pk                            |users_id                           |load_date                      |record_source
    '83E71047DF1368B744E13227B5B8C2C7'  |'30635***005fab65450****5d46f36ad' |'2024-09-27 08:52:12.148 -0500'|'source-1'  
  {% endcall %}
  {% call dbt_unit_testing.mock_ref('sat_table',options) %}
    users_pk                            |users_id                           |email              |first_name |last_name|effective_from                       |load_date                      |record_source
    '83E71047DF1368B744E13227B5B8C2C7'  |'30635***005fab65450****5d46f36ad' |'user123@gmail.com'|'User'     |'Guest'  |'2024-09-27 19:11:44.044000000 +0000'|'2024-09-28 02:11:44.044 -0500'|'source-1'
    '83E71047DF1368B744E13227B5B8C2C7'  |'30635***005fab65450****5d46f36ad' |'user123@gmail.com'|'User'     |'Guest'  |'2024-10-27 19:30:15.708000000 +0000'|'2024-10-28 02:30:15.708 -0500'|'source-1'
    '83E71047DF1368B744E13227B5B8C2C7'  |'30635***005fab65450****5d46f36ad' |'user123@gmail.com'|'User'     |'Guest'  |'2024-11-05 18:02:27.121000000 +0000'|'2024-11-06 02:02:27.121 -0500'|'source-1'
    '83E71047DF1368B744E13227B5B8C2C7'  |'30635***005fab65450****5d46f36ad' |'user123@gmail.com'|'User'     |'Guest'  |'2024-10-30 19:15:02.429000000 +0000'|'2024-10-31 02:15:02.429 -0500'|'source-1'    
  {% endcall %}
  {% call dbt_unit_testing.expect(options) %}
    users_id                            |record_source  |email              |first_name |last_name  |effective_from                       |load_date
    '30635***005fab65450****5d46f36ad'  |'source-1'     |'user123@gmail.com'|'User'     |'Guest'    |'2024-10-30 19:15:02.429000000 +0000'|'2024-10-31 02:15:02.429 -0500'
  {% endcall %}    
{% endcall %}

I am getting the below error,

Database Error in test curr_table (tests/model_test/curr_table_test.sql)
  001003 (42000): SQL compilation error:
  syntax error line 1 at position 0 unexpected 'users_id'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions