Question

Need to get one row from a table, and delete the same row.

It does not matter which row it is. The function should be generic, so the column names are unknown, and there are no identifiers. (Rows as a whole can be assumed to be unique.)

The resulting function would be like a pop() function for a stack, except that the order of elements does not matter.

Possible solutions:

  • Delete into a temporary table.
    (Can this be done in pysqlite?)
  • Get * with 1 as limit, and the Delete * with 1 as limit.
    (Is this safe if there is just one user?)
  • Get one row, then delete with a WHERE clause that compares the whole row.
    (Can this be done in pysqlite?)

Suggestions?

Was it helpful?

Solution

Well. every table in a sqlite has a rowid. Select one and delete it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top