fix: replace commas with dots in depth values

v0.4
rrr-marble 4 years ago
parent 14616e8eb9
commit 1adddacf70

@ -24,7 +24,7 @@ def upgrade() -> None:
"depth_min", "depth_min",
sa.Float(), sa.Float(),
sa.Computed( sa.Computed(
"CAST(SPLIT_PART(depth,'-',1) AS DOUBLE PRECISION)", "CAST(REGEXP_REPLACE(SPLIT_PART(depth,'-',1),',','.') AS DOUBLE PRECISION)",
), ),
nullable=True, nullable=True,
), ),
@ -35,7 +35,7 @@ def upgrade() -> None:
"depth_max", "depth_max",
sa.Float(), sa.Float(),
sa.Computed( sa.Computed(
"CAST(SPLIT_PART(depth,'-',1) AS DOUBLE PRECISION)", "CAST(REGEXP_REPLACE(SPLIT_PART(depth,'-',2),',','.') AS DOUBLE PRECISION)",
), ),
nullable=True, nullable=True,
), ),

@ -48,11 +48,18 @@ class ItemCreate(ItemBase):
class Item(ItemBase): class Item(ItemBase):
# split on '-' replace ',' with '.' and cast as numeric
depth_min = Column( depth_min = Column(
Float, Computed("CAST(SPLIT_PART(depth,'-',1) AS DOUBLE PRECISION)") Float,
Computed(
"CAST(REGEXP_REPLACE(SPLIT_PART(depth,'-',1), ',', '.') AS DOUBLE PRECISION)"
),
) )
depth_max = Column( depth_max = Column(
Float, Computed("CAST(SPLIT_PART(depth,'-',2)) AS DOUBLE PRECISION") Float,
Computed(
"CAST(REGEXP_REPLACE(SPLIT_PART(depth,'-',2), ',', '.') AS DOUBLE PRECISION)"
),
) )
geodata_search_ts = Column( geodata_search_ts = Column(

Loading…
Cancel
Save