Skip to content

Commit

Permalink
add factory methods, doc
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed Oct 18, 2024
1 parent 8864f4e commit 96d0033
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 117 deletions.
11 changes: 10 additions & 1 deletion dbt/adapters/databricks/python_models/python_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@


class PythonJobConfig(BaseModel):
"""Pydantic model for config found in python_job_config."""

name: Optional[str] = None
email_notifications: Optional[Dict[str, Any]] = None
webhook_notifications: Optional[Dict[str, Any]] = None
Expand All @@ -21,6 +23,11 @@ class PythonJobConfig(BaseModel):


class PythonModelConfig(BaseModel):
"""
Pydantic model for a Python model configuration.
Includes some job-specific settings that are not yet part of PythonJobConfig.
"""

user_folder_for_python: bool = False
timeout: int = Field(DEFAULT_TIMEOUT, gt=0)
job_cluster_config: Dict[str, Any] = Field(default_factory=dict)
Expand All @@ -35,9 +42,11 @@ class PythonModelConfig(BaseModel):


class ParsedPythonModel(BaseModel):
"""Pydantic model for a Python model parsed from a dbt manifest"""

catalog: str = Field("hive_metastore", alias="database")

# Reserved name in Pydantic
# Schema is a reserved name in Pydantic
schema_: str = Field("default", alias="schema")

identifier: str = Field(alias="alias")
Expand Down
Loading

0 comments on commit 96d0033

Please sign in to comment.