1+ from .compat import BaseModel
2+ from typing import Dict , Optional , Union , Any
3+
4+
5+ # class ColumnDefinition(BaseModel):
6+ # name: str
7+ # type: Optional[DbldatagenBasicType] = None
8+ # primary: bool = False
9+ # options: Optional[Dict[str, Any]] = {}
10+ # nullable: Optional[bool] = False
11+ # omit: Optional[bool] = False
12+ # baseColumn: Optional[str] = "id"
13+ # baseColumnType: Optional[str] = "auto"
14+
15+ # @model_validator(mode="after")
16+ # def check_constraints(self):
17+ # if self.primary:
18+ # if "min" in self.options or "max" in self.options:
19+ # raise ValueError(
20+ # f"Primary column '{self.name}' cannot have min/max options.")
21+ # if self.nullable:
22+ # raise ValueError(
23+ # f"Primary column '{self.name}' cannot be nullable.")
24+ # if self.primary and self.type is None:
25+ # raise ValueError(
26+ # f"Primary column '{self.name}' must have a type defined.")
27+ # return self
28+
29+
30+ # class TableDefinition(BaseModel):
31+ # number_of_rows: int
32+ # partitions: Optional[int] = None
33+ # columns: List[ColumnDefinition]
34+
35+
36+ # class DatagenSpec(BaseModel):
37+ # tables: Dict[str, TableDefinition]
38+ # output_destination: Optional[Union[UCSchemaTarget, FilePathTarget]] = None
39+ # generator_options: Optional[Dict[str, Any]] = {}
40+ # intended_for_databricks: Optional[bool] = None
41+
42+
43+
44+ # def display_all_tables(self):
45+ # for table_name, table_def in self.tables.items():
46+ # print(f"Table: {table_name}")
47+
48+ # if self.output_destination:
49+ # output = f"{self.output_destination}"
50+ # display(HTML(f"<strong>Output destination:</strong> {output}"))
51+ # else:
52+ # message = (
53+ # "<strong>Output destination:</strong> "
54+ # "<span style='color: red; font-weight: bold;'>None</span><br>"
55+ # "<span style='color: gray;'>Set it using the <code>output_destination</code> "
56+ # "attribute on your <code>DatagenSpec</code> object "
57+ # "(e.g., <code>my_spec.output_destination = UCSchemaTarget(...)</code>).</span>"
58+ # )
59+ # display(HTML(message))
60+
61+ # df = pd.DataFrame([col.dict() for col in table_def.columns])
62+ # try:
63+ # display(df)
64+ # except NameError:
65+ # print(df.to_string())
66+
67+
68+ class DatagenSpec (BaseModel ):
69+ name : str
0 commit comments