Skip to content

Commit

Permalink
Remove computed columns
Browse files Browse the repository at this point in the history
  • Loading branch information
leothomas committed Nov 18, 2023
1 parent 398972c commit 8e05fbd
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions alembic/versions/3c4693517ef6_add_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,39 +146,39 @@ def upgrade() -> None:
sa.Column("machine_confidence", sa.Float),
sa.Column("precursor_slicks", ARRAY(sa.BigInteger)),
sa.Column("notes", sa.Text),
sa.Column(
"length",
sa.Float,
sa.Computed(
"""
GREATEST(
ST_Distance(
ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 1)::geography,
ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 2)::geography
),
ST_Distance(
ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 2)::geography,
ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 3)::geography
)
)
"""
),
),
sa.Column("area", sa.Float, sa.Computed("ST_Area(geometry)")),
sa.Column("perimeter", sa.Float, sa.Computed("ST_Perimeter(geometry)")),
sa.Column("centroid", Geography("POINT"), sa.Computed("ST_Centroid(geometry)")),
sa.Column(
"polsby_popper",
sa.Float,
sa.Computed("4 * pi() * ST_Area(geometry) / ST_Perimeter(geometry)^2"),
),
sa.Column(
"fill_factor",
sa.Float,
sa.Computed(
"ST_Area(geometry) / ST_Area(ST_OrientedEnvelope(geometry::geometry)::geography)"
),
),
# sa.Column(
# "length",
# sa.Float,
# sa.Computed(
# """
# GREATEST(
# ST_Distance(
# ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 1)::geography,
# ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 2)::geography
# ),
# ST_Distance(
# ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 2)::geography,
# ST_PointN(ST_ExteriorRing(ST_OrientedEnvelope(geometry::geometry)), 3)::geography
# )
# )
# """
# ),
# ),
# sa.Column("area", sa.Float, sa.Computed("ST_Area(geometry)")),
# sa.Column("perimeter", sa.Float, sa.Computed("ST_Perimeter(geometry)")),
# sa.Column("centroid", Geography("POINT"), sa.Computed("ST_Centroid(geometry)")),
# sa.Column(
# "polsby_popper",
# sa.Float,
# sa.Computed("4 * pi() * ST_Area(geometry) / ST_Perimeter(geometry)^2"),
# ),
# sa.Column(
# "fill_factor",
# sa.Float,
# sa.Computed(
# "ST_Area(geometry) / ST_Area(ST_OrientedEnvelope(geometry::geometry)::geography)"
# ),
# ),
)

op.create_table(
Expand Down

0 comments on commit 8e05fbd

Please sign in to comment.