Skip to content

Commit

Permalink
fix(sqla): apply sqla type on calculated columns
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Apr 8, 2021
1 parent 56dc74e commit aa604a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ def is_temporal(self) -> bool:

def get_sqla_col(self, label: Optional[str] = None) -> Column:
label = label or self.column_name
db_engine_spec = self.table.database.db_engine_spec
column_spec = db_engine_spec.get_column_spec(self.type)
type_ = column_spec.sqla_type if column_spec else None
if self.expression:
col = literal_column(self.expression)
col = literal_column(self.expression, type_=type_)
else:
db_engine_spec = self.table.database.db_engine_spec
column_spec = db_engine_spec.get_column_spec(self.type)
type_ = column_spec.sqla_type if column_spec else None
col = column(self.column_name, type_=type_)
col = self.table.make_sqla_column_compatible(col, label)
return col
Expand Down

0 comments on commit aa604a4

Please sign in to comment.