Answer the question
In order to leave comments, you need to log in
How to pull rows from database excluding some of them?
There is this function:
def funciton():
list = [1, 3, 5]
with sq.connect(database_path) as con:
cur = con.cursor()
id = cur.execute(f"select row from table where id != {list} order by random() limit 1").fetchone()
print(id)
Answer the question
In order to leave comments, you need to log in
I'm not sure about sqlite, but sql (like python) has an in operator that checks if it's in a list. In your case it should be something like this.
where id not in (v1, v2... vn)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question