Skip to content

Improve model row count #1

@ataft

Description

@ataft

The current logic to get row_count for models uses select * ... and has two potential issues:

  1. There can be hundreds or thousands of models, many of which you may not want to observe. You may only want to observe tables and not views. You may only want to observe the /models/marts folder. You may only want to observe models that were compiled, meaning they were part of the dbt build.
  2. Select * can be slow. For tables, many data warehouses have faster ways to get table row count, for example:
    a) Snowflake: https://www.metaplane.dev/blog/three-ways-to-retrieve-row-counts-for-snowflake-tables-and-views
    b) Redshift: https://www.metaplane.dev/blog/three-ways-to-retrieve-row-counts-in-redshift-tables-and-views

Ideas:

  1. Configure rowcount logic as a variable with the following options:
    a) DISABLED - do not get rowcount
    b) SELECT - use select count(*)
    c) META - use the metadata methodology, depending on database adapter (snowflake, redshift, etc.)
  2. Configure rowcount selector, e.g. only observe "/models/marts" folder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions