ktmud commented on code in PR #19421:
URL: https://github.com/apache/superset/pull/19421#discussion_r839910886
##########
superset/migrations/versions/b8d3a24d9131_new_dataset_models.py:
##########
@@ -150,55 +180,66 @@ def fetch_columns_and_metrics(self, session: Session) ->
None:
Base.metadata,
sa.Column("table_id", sa.ForeignKey("sl_tables.id")),
sa.Column("column_id", sa.ForeignKey("sl_columns.id")),
+ UniqueConstraint("table_id", "column_id"),
)
dataset_column_association_table = sa.Table(
"sl_dataset_columns",
Base.metadata,
sa.Column("dataset_id", sa.ForeignKey("sl_datasets.id")),
sa.Column("column_id", sa.ForeignKey("sl_columns.id")),
+ UniqueConstraint("dataset_id", "column_id"),
)
dataset_table_association_table = sa.Table(
"sl_dataset_tables",
Base.metadata,
sa.Column("dataset_id", sa.ForeignKey("sl_datasets.id")),
sa.Column("table_id", sa.ForeignKey("sl_tables.id")),
+ UniqueConstraint("dataset_id", "table_id"),
)
-class NewColumn(Base):
+class NewColumn(Base, AuxiliaryColumnsMixin):
__tablename__ = "sl_columns"
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.Text)
type = sa.Column(sa.Text)
- expression = sa.Column(sa.Text)
+ expression = sa.Column(MediumText())
+
+ # TODO: jesseyang
+ # this should probably be nullable=False and default=False
+ # do a migration later
is_physical = sa.Column(sa.Boolean, default=True)
- description = sa.Column(sa.Text)
- warning_text = sa.Column(sa.Text)
+
+ description = sa.Column(MediumText())
+ warning_text = sa.Column(MediumText())
+ unit = sa.Column(sa.Text)
Review Comment:
@betodealmeida `unit` is in
[superset.columns.models](https://github.com/apache/superset/blob/a619cb4ea98342a2fdf7f77587d8aa078c7dccef/superset/columns/models.py#L75)
but not in the migration script. Should I keep it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]