4 ms·
Using polars in Python I've gotten similar to work, using LazyFrame and collect in streaming mode: ``` df = pl.scan_parquet('tmp/'+DUMP_NAME+'_cleaned.parquet'
by arrowleaf 2y ago
Using polars in Python I've gotten similar to work, using LazyFrame and collect in streaming mode:
```
df = pl.scan_parquet('tmp/'+DUMP_NAME+'_cleaned.parquet')
with open('tmp/'+DUMP_NAME+'_cleaned.jsonl', mode='w', newline='\n', encoding='utf8') as f:
for row in df.collect(streaming=True).iter_rows(named=True):
row = {k: v for k, v in row.items() if (v is not None and v != [] and v != '')}
f.write(json.dumps(row, default=str) + '\n')
```
- akdor1154 2y agoThis collects all into memory, then iterates.