You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
I have the following unit test setup with csv mock data:
unit_tests:
- name: test_basic_search_id_logic
description: Given a user performs a search within a session, expect all events within the search lifecycle to have the same basic_search_id
model: <model_name>
given:
- input: ref('<input_model_name>')
format: csv
rows: |
id,session_id,event_name,custom_timestamp_utc
1234abcd,"118172","118172",search,173
2345efgh,"118172","118172",page_view,174
3456ijkl,"118172","118172",view_item_list,175
7890mnop,"118172","118172",select_item,176
qrst1234,"118172","118172",page_view,177
uvwx2345,"118172","118172",view_item,178
expect:
format: csv
rows: |
id,session_id,event_name,custom_timestamp_utc,basic_search_id
qrst1234,"118172","118172",page_view,177,"118172173"
3456ijkl,"118172","118172",view_item_list,175,"118172173"
1234abcd,"118172","118172",search,173,"118172173"
7890mnop"118172","118172",select_item,176,"118172173"
uvwx2345,"118172","118172",view_item,178,"118172173"
2345efgh,"118172","118172",page_view,174,"118172173"
And when I run dbt test --select test_type:unit against Redshift, it fails with the following message:
I know it's a tricky one, as the docs state that dbt takes the value you provide and attempts to cast it to the data type as inferred from the input and output models (see docs). In this case basic_search_id is a concatenation of session_id (varchar) and custom_timestamp_utc (bigint) and In the model, I'm specifically casting custom_timestamp_utc to a varchar:
concat(session_id, custom_timestamp_utc::varchar) as basic_search_id
Expected Behavior
I expected that dbt would cast the expected values for basic_search_id to strings as I surrounded them in double quotes, therefore showing the whole value and not treat it as an integer and truncated it.
Steps To Reproduce
See above
Relevant log output
Environment
- dbt-core=1.9.0
Which database adapter are you using with dbt?
redshift
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Is this a new bug in dbt-core?
Current Behavior
I have the following unit test setup with csv mock data:
And when I run

dbt test --select test_type:unit
against Redshift, it fails with the following message:I know it's a tricky one, as the docs state that dbt takes the value you provide and attempts to cast it to the data type as inferred from the input and output models (see docs). In this case
basic_search_id
is a concatenation ofsession_id
(varchar) andcustom_timestamp_utc
(bigint) and In the model, I'm specifically castingcustom_timestamp_utc
to a varchar:Expected Behavior
I expected that dbt would cast the expected values for
basic_search_id
to strings as I surrounded them in double quotes, therefore showing the whole value and not treat it as an integer and truncated it.Steps To Reproduce
See above
Relevant log output
Environment
- dbt-core=1.9.0
Which database adapter are you using with dbt?
redshift
Additional Context
No response
The text was updated successfully, but these errors were encountered: