SPIKE: Validate acceptable performance for switching show terse objects
-> show objects
to enable dynamic table detection
#1038
Labels
bug
Something isn't working
dynamic_tables
High Severity
bug with significant impact that should be resolved in a reasonable timeframe
Summarizing from a conversation with @colin-rogers-dbt @amychen1776 @dataders and the Snowflake streaming team (thanks folks!)
Problem
In the Snowflake 2024_03 behavior change bundle:
show [terse] objects
stopped reportingDYNAMIC_TABLE
as thekind
of dynamic tablesshow objects
added a new column,is_dynamic
, which says whether aTABLE
is a dynamic table. There are likely to be similar columns in the future foris_hybrid
,is_iceberg
, etc. The Snowflake team is standardizing on all of these being attributes ofTABLE
, rather than different objects.Within dbt, we rely on:
Table
or aDynamicTable
at the beginning of the'table'
and'dynamic_table'
materialization flows.show terse objects
, because it's the fastest way to get at all the information we need. This changes with the2024_03
BCB.Proposed resolution
We believe there are two viable options:
show terse objects
→show objects
jerco/spike-show-objects-dts
show terse objects
(~300ms → ~500ms in a schema with 1k objects).terse
conditionally, based on whether there are models materialized asdynamic_table
defined in the project, but this feels like another invitation for edge cases.)RelationType.Table
, with the understanding that we need to run an additionaldescribe
query at the start of thedynamic_table
materialization to figure out if it's actually a dynamic or a static table (among other configs).2024_03
results in dynamic table to issue #1016 (comment)create or replace
when switching between tables and dynamics tables. (The team is looking into this, it may be feasible but it may not be.)describe
statement per DT, until we can re-plumb the materialization logic (or start caching more relation attributes) to avoid rerunning.create or replace table
for DT → table, this will have a known edge case where switchingmaterialized: 'dynamic_table'
tomaterialized: table
does not work.Given that (2) requires a rework to our data model for dynamic tables — no longer a
SnowflakeRelationType.DynamicTable
, really just aSnowflakeRelationType.Table
with an additional attribute — it feels like (1) is our more straightforward resolution in the near term. But we need to first validate that the performance degradation is acceptable (<1s of additional time in large projects/schemas), because we know it will be slightly slower. If it's dramatically slower, then we need to pursue a cleverer (trickier) approach.Acceptance criteria
show objects
(instead ofshow terse objects
) has acceptable performance for multiple databases/schemas containing thousands of objectsThe text was updated successfully, but these errors were encountered: