move parsing logic
This commit is contained in:
21
apps/vinyl/src/plato/parse.py
Normal file
21
apps/vinyl/src/plato/parse.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import polars as pl
|
||||
|
||||
|
||||
def parse(df: pl.LazyFrame) -> pl.LazyFrame:
|
||||
"""Parse the Sounds DataFrame."""
|
||||
ic()
|
||||
return pl.sql(
|
||||
"""
|
||||
SELECT source,
|
||||
CAST(date AS DATE) AS date,
|
||||
ean AS id,
|
||||
_artist AS artist,
|
||||
LOWER(title) AS title,
|
||||
CAST(_date AS DATE) AS release,
|
||||
CAST(_price AS FLOAT) AS price,
|
||||
CONCAT('https://www.platomania.nl', url) AS url
|
||||
FROM df
|
||||
QUALIFY ROW_NUMBER() OVER (PARTITION BY source, id, artist, title, price ORDER BY date DESC) = 1
|
||||
ORDER BY date ASC
|
||||
"""
|
||||
)
|
||||
Reference in New Issue
Block a user