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

Add rows_affected column for snowflake #208

Merged

Conversation

iribarnesy
Copy link
Contributor

Reference the issue #196

[x] model_executions
[x] seed_executions
[x] snapshot_executions

@iribarnesy iribarnesy temporarily deployed to Approve Integration Tests September 21, 2022 13:15 Inactive
@iribarnesy iribarnesy temporarily deployed to Approve Integration Tests September 21, 2022 13:15 Inactive
@iribarnesy iribarnesy temporarily deployed to Approve Integration Tests September 21, 2022 13:15 Inactive
@iribarnesy iribarnesy temporarily deployed to Approve Integration Tests September 21, 2022 13:15 Inactive
@NiallRees NiallRees merged commit 5873056 into brooklyn-data:main Sep 22, 2022
@NiallRees
Copy link
Contributor

Thank you @iribarnesy !

@iribarnesy iribarnesy deleted the FEAT/snowflake-add-rows-affected branch September 23, 2022 07:40
@bhratkapoor
Copy link

Hi @iribarnesy, I have used the latest code for upload_model_executions.sql file, now rows_affected column value is reflecting but its always inserting 1.

Sample Model used :
{{ config(
materialized='table',
database='Test',
schema='temp_schema',
alias='testing1'
) }}

select * from "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" where C_Nationkey=13

MODEL_EXECUTIONS table is getting populated with 1 as rows_affected column

@iribarnesy
Copy link
Contributor Author

iribarnesy commented Sep 23, 2022

Hi @iribarnesy, I have used the latest code for upload_model_executions.sql file, now rows_affected column value is reflecting but its always inserting 1.

Sample Model used : {{ config( materialized='table', database='Test', schema='temp_schema', alias='testing1' ) }}

select * from "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" where C_Nationkey=13

MODEL_EXECUTIONS table is getting populated with 1 as rows_affected column

As I investigated before pushing that piece of code, I thought that the first run of any model will always return 1 for the number of rows_affected. I don't know if the source of this behavior is dbt-snowflake or snowflake.

@NiallRees
Copy link
Contributor

Could you try using dbt-snowflake==1.2.0? This behaviour should have been fixed as part of dbt-labs/dbt-snowflake#153.

@bhratkapoor
Copy link

I am using 1.2.1 version and getting always 1 in row_affected column

On model.my_new_project.test1: /* {"app": "dbt", "dbt_version": "1.2.1", "profile_name": "user", "target_name": "default", "node_id": "model.my_new_project.test1"} */
create or replace transient table Test.temp_schema.testing1 as
(

select * from "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" where C_Nationkey=13
);

@NiallRees
Copy link
Contributor

You'll only see values greater other than 1 for incremental models which are running incrementally (not a full refresh), which it doesn't look like your example is. Snowflake only reports row counts for insert and merge into statements. Would you be able to try it with an incremental model and report back?

@bhratkapoor
Copy link

Great, I changes the materialized='incremental'. Now its capturing the affected rows. Thanks 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

Successfully merging this pull request may close these issues.

3 participants