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

[Bug] #1365

Open
1 task
martijnroo opened this issue Dec 5, 2024 · 1 comment
Open
1 task

[Bug] #1365

martijnroo opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working customer request An Astronomer customer made requested this dbt:test Primarily related to dbt test command or functionality duplicate This issue or pull request already exists execution:local Related to Local execution environment

Comments

@martijnroo
Copy link

Astronomer Cosmos Version

1.7.1

dbt-core version

1.7.18

Versions of dbt adapters

dbt-redshift==1.7.7

LoadMode

AUTOMATIC

ExecutionMode

LOCAL

InvocationMode

None

airflow version

2.7.3

Operating System

MacOS

If a you think it's an UI issue, what browsers are you seeing the problem on?

No response

Deployment

Astronomer

Deployment details

No response

What happened?

I have a dbt test that looks like this:

SELECT d_item.item_code,
       d_item.item_inventory_flag AS item_inventory_flag_in_analytical,
       flag.inventory_flag_value AS item_inventory_flag_in_source
FROM {{ ref('analytical_d_item') }}
INNER JOIN {{ ref('inventory_flag_sap') }} AS flag
    ON d_item.item_code = flag.item_code
WHERE d_item.item_inventory_flag <> flag.inventory_flag_value

Cosmos runs this test after the analytical_d_item model as well as after the inventory_flag_sap model, so the test is run two times. Because of this, the test runs before both models have run and therefore it always fails. The test should run after both models it depends on have run.

Relevant log output

How to reproduce

Create three files:
a.sql

SELECT 1 AS id

b.sql

SELECT id FROM {{ ref('a') }}

assert_c.sql

SELECT a.id, b.id
FROM {{ ref('a') }}
LEFT JOIN {{ ref('b') }} USING (id)
WHERE a.id != b.id

Since b depends on a, it will be run after a's tests have run. assert_c is run directly after a, even though it depends on b as well. Cosmos ignores this. assert_c will fail, because table b doesn't exist yet.

Anything else :)?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Contact Details

No response

@martijnroo martijnroo added bug Something isn't working triage-needed Items need to be reviewed / assigned to milestone labels Dec 5, 2024
@dosubot dosubot bot added dbt:test Primarily related to dbt test command or functionality execution:local Related to Local execution environment labels Dec 5, 2024
@tatiana
Copy link
Collaborator

tatiana commented Dec 5, 2024

Hi @martijnroo , thank you very much for reporting this issue!
It seems a duplicate of #978. I added this as a subtask of the original issue.
I'll tentatively add the original ticket to the Cosmos 1.8 milestone, and we'll address it in our next sprint.

@tatiana tatiana added customer request An Astronomer customer made requested this duplicate This issue or pull request already exists and removed triage-needed Items need to be reviewed / assigned to milestone labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer request An Astronomer customer made requested this dbt:test Primarily related to dbt test command or functionality duplicate This issue or pull request already exists execution:local Related to Local execution environment
Projects
None yet
Development

No branches or pull requests

2 participants