Skip to content

Commit 757c9d0

Browse files
committed
Add script to reset prospects flags and hide
Add a utility script app/api/prospects/database/reset_flag_and_hide.py that resets the `flag` and `hide` columns to FALSE for all rows in the prospects table. It obtains a DB connection from get_db_connection(), executes the UPDATE, commits on success, rolls back on exception, and ensures cursor/connection are closed. The script can be run directly as a standalone command.
1 parent bdf66c8 commit 757c9d0

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Script to reset all 'flag' and 'hide' values to false in the prospects table
2+
from app.utils.db import get_db_connection
3+
4+
def reset_flag_and_hide():
5+
conn_gen = get_db_connection()
6+
conn = next(conn_gen)
7+
cur = conn.cursor()
8+
try:
9+
cur.execute("UPDATE prospects SET flag = FALSE, hide = FALSE;")
10+
conn.commit()
11+
print("All 'flag' and 'hide' values reset to FALSE.")
12+
except Exception as e:
13+
print(f"Error: {e}")
14+
conn.rollback()
15+
finally:
16+
cur.close()
17+
conn.close()
18+
19+
if __name__ == "__main__":
20+
reset_flag_and_hide()

0 commit comments

Comments
 (0)