Skip to content
Discussion options

You must be logged in to vote

@urkle What about using a Common Table Expression (CTE)?

$qsv sqlp data.csv "WITH t AS (SELECT id, string_to_array(data, ',') as arr FROM data)
  SELECT id, unnest(arr) as value FROM t"
id,value
1,a
1,b
1,c
2,
3,b
3,c
3,d
(7, 2)

By first creating the array in a CTE then selecting from it, Polars SQL can maintain the row-by-row relationship...

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@urkle
Comment options

@jqnatividad
Comment options

@jqnatividad
Comment options

@urkle
Comment options

@jqnatividad
Comment options

Answer selected by jqnatividad
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #3108 on November 20, 2025 04:45.