@@ -56,38 +56,37 @@ class Table(BaseModel):
5656 dbschema : str = Field (..., alias = "schema" )
5757 description : Optional [str ]
5858 id_column : Optional [str ]
59- geometry_columns : Optional [ List [GeometryColumn ] ]
59+ geometry_columns : List [GeometryColumn ]
6060 properties : List [Column ]
6161
6262 @property
63- def datetime_columns (self ) -> Optional [ List [Column ] ]:
63+ def datetime_columns (self ) -> List [Column ]:
6464 """Return the name of all timestamptz columns."""
6565 return [p for p in self .properties if p .type .startswith ("timestamp" )]
6666
67- def datetime_column (self , dtcol : Optional [str ] = None ):
67+ def datetime_column (self , name : Optional [str ] = None ) -> Optional [ Column ] :
6868 """Return the Column for either the passed in tstz column or the first tstz column."""
69- if self .datetime_columns :
70- for col in self .datetime_columns :
71- if dtcol is None or col .name == dtcol :
72- return col
69+ for col in self .datetime_columns :
70+ if name is None or col .name == name :
71+ return col
7372
7473 return None
7574
76- def geometry_column (self , gcol : Optional [str ] = None ) -> Optional [GeometryColumn ]:
75+ def geometry_column (self , name : Optional [str ] = None ) -> Optional [GeometryColumn ]:
7776 """Return the name of the first geometry column."""
78- if self .geometry_columns is not None and len ( self . geometry_columns ) > 0 :
79- for c in self .geometry_columns :
80- if gcol is None or c .name == gcol :
81- return c
77+ if self .geometry_columns :
78+ for col in self .geometry_columns :
79+ if name is None or col .name == name :
80+ return col
8281
8382 return None
8483
8584 @property
8685 def id_column_info (self ) -> Column : # type: ignore
8786 """Return Column for a unique identifier."""
88- for c in self .properties :
89- if c .name == self .id_column :
90- return c
87+ for col in self .properties :
88+ if col .name == self .id_column :
89+ return col
9190
9291 def columns (self , properties : Optional [List [str ]] = None ) -> List [str ]:
9392 """Return table columns optionally filtered to only include columns from properties."""
@@ -100,7 +99,7 @@ def columns(self, properties: Optional[List[str]] = None) -> List[str]:
10099 if geom_col :
101100 properties .append (geom_col .name )
102101
103- cols = [c for c in cols if c in properties ]
102+ cols = [col for col in cols if col in properties ]
104103
105104 if len (cols ) < 1 :
106105 raise TypeError ("No columns selected" )
0 commit comments