18

Is it possible in sqlalchemy to lazy load a column? I have large BLOB column that I'm usually using but in some cases I don't want to load this specific column (while I'd like to have ORM object). Is it possible without adding separate table?

1 Answer 1

21
class Book(Base):
    __tablename__ = 'books'

    book_id = Column(Integer, primary_key=True)
    title = Column(String(200), nullable=False)
    summary = Column(String(2000))
    excerpt = deferred(Column(Text))
    photo = deferred(Column(Binary))

Deferred Column Loading

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.