Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/auto-classification/add-support-for-another-entity.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,11 @@ WHERE name = 'AutoClassificationBotPolicy';
**Location:** `ingestion/src/metadata/pii/types.py`

```python
from typing import Union
from metadata.generated.schema.entity.data.container import Container
from metadata.generated.schema.entity.data.table import Table
from metadata.generated.schema.entity.data.topic import Topic # Your new entity

ClassifiableEntityType = Union[Table, Container, Topic]
ClassifiableEntityType = Table | Container | Topic
```

#### 3.2 Register Entity Adapter
Expand Down Expand Up @@ -504,7 +503,7 @@ class YourEntityFetcherStrategy(FetcherStrategy):
self,
config: OpenMetadataWorkflowConfig,
metadata: OpenMetadata,
global_profiler_config: Optional[Settings],
global_profiler_config: Settings | None,
status: Status,
) -> None:
super().__init__(config, metadata, global_profiler_config, status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Add the `MultiDBSource` mixin when a single server connection can access multipl

```python
class MyDbSource(CommonDbSourceService, MultiDBSource):
def get_configured_database(self) -> Optional[str]:
def get_configured_database(self) -> str | None:
return self.service_connection.databaseName

def get_database_names_raw(self) -> Iterable[str]:
Expand Down
10 changes: 5 additions & 5 deletions skills/standards/code_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Order: stdlib → third-party → OpenMetadata generated → OpenMetadata intern
```python
import json
import traceback
from collections.abc import Iterable
from functools import partial
from typing import Iterable, Optional

import requests
from sqlalchemy.engine import Engine
Expand All @@ -30,7 +30,7 @@ from metadata.utils.logger import ingestion_logger

### Type Annotations
- All function signatures must have type annotations
- Use `Optional[T]` for nullable fields
- Use `T | None` for nullable fields
- Use `Iterable[Either[...]]` for yield methods
- Import types from `typing` or `collections.abc`

Expand All @@ -44,7 +44,7 @@ from metadata.utils.logger import ingestion_logger

When defining Pydantic models for API responses with aliased fields:
- Always set `model_config = ConfigDict(populate_by_name=True)` when using `Field(alias=...)` — without it, constructing instances with Python attribute names raises `ValidationError`
- Use `Optional[T]` with `Field(None, alias=...)` for nullable fields
- Use `T | None` with `Field(None, alias=...)` for nullable fields
- Create list response wrapper models inheriting from a base OData/pagination response

```python
Expand All @@ -55,11 +55,11 @@ class MyApiReport(BaseModel):

id: str = Field(alias="Id")
name: str = Field(alias="Name")
description: Optional[str] = Field(None, alias="Description")
description: str | None = Field(None, alias="Description")


class MyApiListResponse(BaseModel):
value: List[MyApiReport] = Field(default_factory=list)
value: list[MyApiReport] = Field(default_factory=list)
```

### Error Messages
Expand Down
8 changes: 5 additions & 3 deletions skills/standards/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ def read_config(self, path: str) -> dict:
```python
MAX_METADATA_FILE_SIZE = 50 * 1024 * 1024 # 50 MB

def read_metadata_file(self, path: str) -> Optional[dict]:
def read_metadata_file(self, path: str) -> dict | None:
"""Read a metadata/manifest file with size guard."""
head = self.client.head_object(Bucket=self.bucket, Key=path)
size = head["ContentLength"]
if size > MAX_METADATA_FILE_SIZE:
logger.warning(
f"Skipping {path}: file size {size} exceeds limit "
f"{MAX_METADATA_FILE_SIZE}"
"Skipping %s: file size %s exceeds limit %s",
path,
size,
MAX_METADATA_FILE_SIZE,
)
return None
response = self.client.get_object(Bucket=self.bucket, Key=path)
Expand Down
2 changes: 1 addition & 1 deletion skills/standards/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _get(self, endpoint):
response = self._session.get(f"{self._base_url}{endpoint}")
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 30))
logger.warning(f"Rate limited, retrying after {retry_after}s")
logger.warning("Rate limited, retrying after %ss", retry_after)
raise RateLimitError(retry_after)
response.raise_for_status()
return response.json()
Expand Down
2 changes: 1 addition & 1 deletion skills/standards/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Add `MultiDBSource` mixin when the database server hosts multiple independent da

```python
class MyDbSource(CommonDbSourceService, MultiDBSource):
def get_configured_database(self) -> Optional[str]:
def get_configured_database(self) -> str | None:
return self.service_connection.databaseName

def get_database_names_raw(self) -> Iterable[str]:
Expand Down
Loading