Skip to content

Commit

Permalink
Addressing comments (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Feb 23, 2022
1 parent eb2d588 commit ba2ddb0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
8 changes: 4 additions & 4 deletions superset/columns/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Column(
# Additional metadata describing the column.
description = sa.Column(sa.Text)
warning_text = sa.Column(sa.Text)
units = sa.Column(sa.Text)
unit = sa.Column(sa.Text)

# Is this a time column? Useful for plotting time series.
is_temporal = sa.Column(sa.Boolean, default=False)
Expand All @@ -90,6 +90,6 @@ class Column(
# additive, so it shouldn't be used in a ``SUM``.
is_additive = sa.Column(sa.Boolean, default=False)

# Is an increase good? Useful for displaying the results of A/B tests, or setting up
# alerts. Eg, this is true for "revenue", but false for "latency".
increase_good = sa.Column(sa.Boolean, default=True)
# Is an increase desired? Useful for displaying the results of A/B tests, or setting
# up alerts. Eg, this is true for "revenue", but false for "latency".
is_increase_desired = sa.Column(sa.Boolean, default=True)
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def upgrade():
sa.Column("is_physical", sa.BOOLEAN(), nullable=False, default=True,),
sa.Column("description", sa.TEXT(), nullable=True),
sa.Column("warning_text", sa.TEXT(), nullable=True),
sa.Column("units", sa.TEXT(), nullable=True),
sa.Column("unit", sa.TEXT(), nullable=True),
sa.Column("is_temporal", sa.BOOLEAN(), nullable=False),
sa.Column("is_spatial", sa.BOOLEAN(), nullable=False, default=False,),
sa.Column("is_partition", sa.BOOLEAN(), nullable=False, default=False,),
sa.Column("is_aggregation", sa.BOOLEAN(), nullable=False, default=False,),
sa.Column("is_additive", sa.BOOLEAN(), nullable=False, default=False,),
sa.Column("increase_good", sa.BOOLEAN(), nullable=False, default=True,),
sa.Column("is_increase_desired", sa.BOOLEAN(), nullable=False, default=True,),
sa.PrimaryKeyConstraint("id"),
)
with op.batch_alter_table("sl_columns") as batch_op:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/columns/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_column_model(app_context: None, session: Session) -> None:
# test that default values are set correctly
assert column.description is None
assert column.warning_text is None
assert column.units is None
assert column.unit is None
assert column.is_temporal is False
assert column.is_spatial is False
assert column.is_partition is False
Expand Down
32 changes: 16 additions & 16 deletions tests/unit_tests/datasets/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_create_physical_sqlatable(app_context: None, session: Session) -> None:
"is_temporal": True,
"name": "ds",
"type": "TIMESTAMP",
"units": None,
"unit": None,
"warning_text": None,
},
{
Expand All @@ -357,7 +357,7 @@ def test_create_physical_sqlatable(app_context: None, session: Session) -> None:
"is_temporal": False,
"name": "user_id",
"type": "INTEGER",
"units": None,
"unit": None,
"warning_text": None,
},
{
Expand All @@ -376,7 +376,7 @@ def test_create_physical_sqlatable(app_context: None, session: Session) -> None:
"is_temporal": False,
"name": "revenue",
"type": "INTEGER",
"units": None,
"unit": None,
"warning_text": None,
},
{
Expand All @@ -395,7 +395,7 @@ def test_create_physical_sqlatable(app_context: None, session: Session) -> None:
"is_temporal": False,
"name": "expenses",
"type": "INTEGER",
"units": None,
"unit": None,
"warning_text": None,
},
{
Expand All @@ -414,7 +414,7 @@ def test_create_physical_sqlatable(app_context: None, session: Session) -> None:
"is_temporal": False,
"name": "profit",
"type": "INTEGER",
"units": None,
"unit": None,
"warning_text": None,
},
{
Expand All @@ -433,7 +433,7 @@ def test_create_physical_sqlatable(app_context: None, session: Session) -> None:
"is_temporal": False,
"name": "cnt",
"type": "Unknown",
"units": None,
"unit": None,
"warning_text": None,
},
]
Expand Down Expand Up @@ -587,7 +587,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": None,
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -606,7 +606,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": None,
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -625,7 +625,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": None,
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -644,7 +644,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": None,
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -663,7 +663,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": "ds",
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -682,7 +682,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": "user_id",
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -701,7 +701,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": "revenue",
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -720,7 +720,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": "expenses",
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -739,7 +739,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": "revenue-expenses",
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand All @@ -758,7 +758,7 @@ def test_create_virtual_sqlatable(
"extra_json": "{}",
"is_partition": False,
"expression": "COUNT(*)",
"units": None,
"unit": None,
"warning_text": None,
"created_by": None,
"increase_good": True,
Expand Down
3 changes: 0 additions & 3 deletions tests/unit_tests/tables/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ def test_table_model(app_context: None, session: Session) -> None:

assert table.id == 1
assert table.uuid is not None

assert table.database_id == 1

assert table.catalog == "my_catalog"
assert table.schema == "my_schema"
assert table.name == "my_table"

assert [column.name for column in table.columns] == ["ds"]

0 comments on commit ba2ddb0

Please sign in to comment.