Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipeline delimiter not working in expect() block #219

Open
sangee14 opened this issue Nov 11, 2024 · 3 comments
Open

pipeline delimiter not working in expect() block #219

sangee14 opened this issue Nov 11, 2024 · 3 comments

Comments

@sangee14
Copy link

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'.
@psousa50
Copy link
Collaborator

Hi @sangee14 ,

Thank you for your feedback.
I can't reproduce your issue. Please run your test with --vars "verbose: true" and send me the output. It would also help if you send your unit_tests_config` as well.
Thanks

@sangee14
Copy link
Author

The issue got fixed by making changes in the tab space for each column. Is there any limitations/requirement in the tab space? Like there should not be more than 5 tabs or some thing like this.

@psousa50
Copy link
Collaborator

psousa50 commented Nov 11, 2024

afik, there are no limitations. Can you please share your working test so that we can try to spot the issue?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants