HR-ATS-Portal/backend/_tz_sample.py

37 lines
1.2 KiB
Python

"""One-shot: print live timestamp samples. Delete after use."""
import asyncio
from sqlalchemy import text
from db_setup import get_sessionmaker
async def main():
async with get_sessionmaker()() as s:
r = await s.execute(
text(
"SELECT message_received_time, created_at "
"FROM inbox_messages "
"WHERE message_received_time IS NOT NULL "
"AND btrim(message_received_time) <> '' "
"ORDER BY created_at DESC LIMIT 5"
)
)
print("=== EMAIL received | created_at ===")
for row in r:
print(repr(row[0]), "|", row[1])
r = await s.execute(
text(
"SELECT entry_date, entry_time, created_at, "
"raw_record->>'Timestamp' AS sheet_ts "
"FROM form_data WHERE entry_date IS NOT NULL "
"ORDER BY created_at DESC LIMIT 5"
)
)
print("=== FORM entry_date | entry_time | created_at | Timestamp ===")
for row in r:
print(row[0], "|", repr(row[1]), "|", row[2], "|", repr(row[3]))
if __name__ == "__main__":
asyncio.run(main())