db_utils.py 330 B

12345678910111213141516
  1. from utils import Base, metadata_rc, session_rc
  2. from sqlalchemy import Table
  3. class Documents(Base):
  4. __table__ = Table("core_document", metadata_rc)
  5. def get_documents():
  6. documents = session_rc.query(Documents).all()
  7. for document in documents:
  8. yield document
  9. if __name__ == "__main__":
  10. get_documents()