Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top