Skip to content

Generate uuid columns #1564

Answered by saulpw
kerruba-milkman asked this question in Q&A
Oct 13, 2022 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Hey @kerruba-milkman, that's an interesting question. One thing you could do is "freeze" (with ') the column after creating it, and then hide the original column and use the new frozen column for everything. You could also incorporate this into your command by using addColumnAtCursor(StaticColumn(uuidColumn(cursorCol))) as the execstr.

Alternatively, you could follow the setcol- command pattern rather than the addcol- pattern, since you want them to be set once and never recalculated. For instance:

@Column.api
@asyncthread
def setcol_uuid(col, rows):
    col.setValues(rows, *[uuid.uuid4() for r in rows])

Sheet.addCommand('', 'setcol-uuid', 'cursorCol.setcol_uuid(someSelectedRows)')

(The @…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@kerruba-milkman
Comment options

@lkhrs
Comment options

@kerruba-milkman
Comment options

@kerruba-milkman
Comment options

@saulpw
Comment options

Answer selected by kerruba-milkman
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