Skip to content

Commit 6e6d8ed

Browse files
Aryamanz29claude
andcommitted
BLDX-689 | fix: add DbtTest under TYPE_CHECKING in SQL to satisfy ruff/mypy
The SQL → DbtTest circular import skip removed the bottom import of DbtTest from s_q_l.py, leaving DbtTest undefined for type annotations. Added SQL to _ASSETS_REQUIRE_TYPE_CHECKING and a TYPE_CHECKING guard in module.jinja2 to import DbtTest at type-check time only, matching the DataQualityRule → Column pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d557b1b commit 6e6d8ed

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

pyatlan/generator/class_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ class AssetInfo:
232232
"Purpose",
233233
"DataQualityRule",
234234
"Process",
235+
"SQL",
235236
}
236237
_ASSETS_REQUIRE_ASYNC_CLIENT = {
237238
"Badge",

pyatlan/generator/templates/module.jinja2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ if TYPE_CHECKING:
4949
{% if asset_info.name == 'DbtProcess' %}
5050
from pyatlan.model.assets import Procedure, BigqueryRoutine, FabricActivity, Function
5151
{% endif %}
52+
{% if asset_info.name == 'SQL' %}
53+
from pyatlan.model.assets.core.dbt_test import DbtTest
54+
{% endif %}
5255
{% if asset_info.name in asset_info._ASSETS_REQUIRE_ASYNC_CLIENT %}
5356
from pyatlan.client.aio.client import AsyncAtlanClient
5457
from pyatlan.model.aio import AsyncCustomMetadataProxy

pyatlan/model/assets/core/s_q_l.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from __future__ import annotations
66

77
from datetime import datetime
8-
from typing import ClassVar, Dict, List, Optional
8+
from typing import TYPE_CHECKING, ClassVar, Dict, List, Optional
99

1010
from pydantic.v1 import Field, validator
1111

@@ -19,6 +19,9 @@
1919

2020
from .catalog import Catalog
2121

22+
if TYPE_CHECKING:
23+
from pyatlan.model.assets.core.dbt_test import DbtTest
24+
2225

2326
class SQL(Catalog):
2427
"""Description"""

0 commit comments

Comments
 (0)