You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fabric uses T-SQL with BIT booleans and has several SQL dialect
differences from PostgreSQL/Snowflake/BigQuery. This commit makes
the package cross-platform compatible with Fabric DW by:
- Adding fabric__recursive_dag (loop-based, no recursive CTEs)
- Adding fabric__get_dbtreplace_directory_pattern (no regexp_replace)
- Adding fabric__type_string_dpe (varchar(8000))
- Adding quote_identifier/bool_literal dispatch macros
- Replacing boolean expressions in SELECT with CASE WHEN
- Replacing bare booleans in WHERE with explicit comparisons
- Replacing GROUP BY ordinals with column names
- Replacing || with dbt.concat()
- Replacing 'where false' with 'where 1=0'
- Replacing cast(True/False as ...) with cast(1/0 as ...)
- Adding 'fabric' to target.type conditionals
- Guarding ORDER BY in CTEs (invalid in T-SQL without TOP)
Relates to #229
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cte_{{ i -1 }}.child_materialized in ('view', 'ephemeral')
318
+
and coalesce(cte_{{ i -1 }}.is_dependent_on_chain_of_views, cast(1asbit)) = cast(1asbit)
319
+
then cast(1asbit)
320
+
else cast(0asbit)
321
+
end as is_dependent_on_chain_of_views
322
+
323
+
from direct_relationships
324
+
inner join cte_{{ i -1 }}
325
+
on cte_{{ i -1 }}.child_id =direct_relationships.direct_parent_id
326
+
)
327
+
{% endfor %}
328
+
329
+
, all_relationships_unioned as (
330
+
{% for i in range(max_depth) %}
331
+
select*from cte_{{ i }}
332
+
{% if not loop.last %}union all{% endif %}
333
+
{% endfor %}
334
+
)
335
+
336
+
, resource_info as (
337
+
select*from {{ ref('int_all_graph_resources') }}
338
+
)
339
+
340
+
, all_relationships as (
341
+
select
342
+
parent.resource_idas parent_id,
343
+
parent.resource_nameas parent,
344
+
parent.resource_typeas parent_resource_type,
345
+
parent.model_typeas parent_model_type,
346
+
parent.materializedas parent_materialized,
347
+
parent.is_publicas parent_is_public,
348
+
parent.accessas parent_access,
349
+
parent.source_nameas parent_source_name,
350
+
parent.file_pathas parent_file_path,
351
+
parent.directory_pathas parent_directory_path,
352
+
parent.file_nameas parent_file_name,
353
+
parent.is_excludedas parent_is_excluded,
354
+
child.resource_idas child_id,
355
+
child.resource_nameas child,
356
+
child.resource_typeas child_resource_type,
357
+
child.model_typeas child_model_type,
358
+
child.materializedas child_materialized,
359
+
child.is_publicas child_is_public,
360
+
child.accessas child_access,
361
+
child.source_nameas child_source_name,
362
+
child.file_pathas child_file_path,
363
+
child.directory_pathas child_directory_path,
364
+
child.file_nameas child_file_name,
365
+
child.is_excludedas child_is_excluded,
366
+
cast(all_relationships_unioned.distanceas {{ dbt.type_int() }}) as distance,
367
+
all_relationships_unioned.path,
368
+
case when all_relationships_unioned.is_dependent_on_chain_of_views= cast(1asbit) then cast(1asbit) else cast(0asbit) end as is_dependent_on_chain_of_views
0 commit comments