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

[CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI #147

Closed
1 task done
crystalro0 opened this issue Apr 25, 2022 · 1 comment · Fixed by #153
Closed
1 task done

[CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI #147

crystalro0 opened this issue Apr 25, 2022 · 1 comment · Fixed by #153
Labels
bug Something isn't working

Comments

@crystalro0
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

User upgraded to v1.0 and is not seeing the same number of rows_affected in run logging.

Seen in 0.18.1 logging:

00:00:01 | 1 of 1 OK created incremental model GEN.foobar [ [32mSUCCESS 130692981 [0m in 175.96s]

in v1.0 logging:

00:00:01 | 1 of 1 OK created incremental model GEN.foobar [ [32mSUCCESS 1 [0m in 188.32s]

Screenshot of user's snowflake history shows ~130M rows.

Expected Behavior

The rows_affected number should be displaying the actual number (unless bound by limit).

Steps To Reproduce

  1. Using 0.18.1 and snowflake: create job and run.
  2. Upgrade to 1.0.
  3. Re-run job.

Relevant log output

Please ping in slack for additional information if needed. ZD ticket and logging available.

Environment

- dbt: 1.0.4

What database are you using dbt with?

snowflake

Additional Context

No response

@crystalro0 crystalro0 added bug Something isn't working triage labels Apr 25, 2022
@github-actions github-actions bot changed the title [Bug] Rows_affected showing as 1 in run_results.json and in UI [CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI Apr 25, 2022
@jtcohen6
Copy link
Contributor

jtcohen6 commented Apr 26, 2022

Thanks for opening @crystalro0!

I realized this is due to dbt-labs/dbt-core#3510, which was included in v0.21. Previously, the last statement run during incremental transformations was merge or insert, and it would include the number of rows_affected. Now, it's an explicit commit statement (per the advice of Snowflake), which only ever returns 1:

08:21:48.768927 [debug] [Thread-1  ]: On model.testy.model_a: insert into ad_hoc.dbt_jcohen.model_a ("ID")
        (
            select "ID"
            from ad_hoc.dbt_jcohen.model_a__dbt_tmp
        );
08:21:49.480126 [debug] [Thread-1  ]: SQL status: SUCCESS 123 in 0.71 seconds
08:21:49.480654 [debug] [Thread-1  ]: Using snowflake connection "model.testy.model_a"
08:21:49.480949 [debug] [Thread-1  ]: On model.testy.model_a: commit;
08:21:49.844254 [debug] [Thread-1  ]: SQL status: SUCCESS 1 in 0.36 seconds

It's that final SUCCESS 1 which is now reported as the result for the incremental model, rather than SUCCESS 123.

We'd need to see if there's a way we can return the rows_affected from the pre-commit statement(s). It may be tricky, given how we're (naively) wrapping each statement in naive begin + commit to guarantee transaction success and cost-effectiveness. I'm going to transfer this issue to dbt-snowflake, since that's where we'd need to make the change.

@jtcohen6 jtcohen6 removed the triage label Apr 26, 2022
@jtcohen6 jtcohen6 transferred this issue from dbt-labs/dbt-core Apr 26, 2022
@github-actions github-actions bot changed the title [CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI [CT-555] [CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI Apr 26, 2022
@leahwicz leahwicz changed the title [CT-555] [CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI [CT-552] [Bug] Rows_affected showing as 1 in run_results.json and in UI May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants