2020
2121
2222class ForeignKeyRelationship (BaseModel ):
23- source_column : str = Field (..., alias = "Column" )
23+ column : str = Field (..., alias = "Column" )
2424 foreign_column : str = Field (..., alias = "ForeignColumn" )
2525
26+ model_config = ConfigDict (populate_by_name = True , arbitrary_types_allowed = True )
27+
2628
2729class EntityRelationship (BaseModel ):
30+ entity : str = Field (..., alias = "Entity" )
2831 foreign_entity : str = Field (..., alias = "ForeignEntity" )
2932 foreign_keys : list [ForeignKeyRelationship ] = Field (..., alias = "ForeignKeys" )
3033
31- def pivot (self , entity : str ):
34+ model_config = ConfigDict (populate_by_name = True , arbitrary_types_allowed = True )
35+
36+ def pivot (self ):
3237 """A method to pivot the entity relationship."""
3338 return EntityRelationship (
34- foreign_entity = entity ,
39+ entity = self .foreign_entity ,
40+ foreign_entity = self .entity ,
3541 foreign_keys = [
3642 ForeignKeyRelationship (
3743 source_column = foreign_key .foreign_column ,
@@ -53,7 +59,7 @@ def from_sql_row(cls, row, columns):
5359 foreign_entity = result ["ForeignEntity" ],
5460 foreign_keys = [
5561 ForeignKeyRelationship (
56- source_column = result ["Column" ],
62+ column = result ["Column" ],
5763 foreign_column = result ["ForeignColumn" ],
5864 )
5965 ],
@@ -100,7 +106,7 @@ class EntityItem(BaseModel):
100106 None , alias = "EntityRelationships"
101107 )
102108
103- complete_entity_relationship_graph = Optional [str ] = Field (
109+ complete_entity_relationship_graph : Optional [str ] = Field (
104110 None , alias = "CompleteEntityRelationshipGraph"
105111 )
106112
0 commit comments