Mercurial > repos > tduigou > save_to_db
comparison verification.py @ 0:034686b5bc15 draft
planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
| author | tduigou |
|---|---|
| date | Thu, 24 Apr 2025 09:56:36 +0000 |
| parents | |
| children | 6854ac8c5d2b |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:034686b5bc15 |
|---|---|
| 1 from sqlalchemy import create_engine, text | |
| 2 | |
| 3 db_uri = "postgresql://postgres:RK17@localhost:5432/test_fragments_db" | |
| 4 engine = create_engine(db_uri) | |
| 5 | |
| 6 with engine.connect() as conn: | |
| 7 result = conn.execute(text(""" | |
| 8 SELECT fragment, sequence, annotation | |
| 9 FROM sample | |
| 10 ORDER BY fragment | |
| 11 """)) | |
| 12 | |
| 13 print("Full contents of fragments in DB:\n") | |
| 14 for row in result: | |
| 15 print(f" Fragment: {row.fragment}") | |
| 16 print(" Sequence:") | |
| 17 print(row.sequence) | |
| 18 print("\n Annotation:") | |
| 19 print(row.annotation) | |
| 20 print("-" * 80) |
