We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all,
When trying to query specific columns, mock-alchemy seems to return nothing at all. I wrote this standalone script so you can see what I mean:
import uuid from mock_alchemy.mocking import UnifiedAlchemyMagicMock from sqlalchemy import Column, String, Integer from sqlalchemy.orm import declarative_base Base = declarative_base() class Brand(Base): __tablename__ = "brand_table" id: str = Column("id", String, primary_key=True) brand_name: str = Column("brand_name", String) brand_id: int = Column("brand_id", Integer) def test_read_brand_id(): data = Brand(id=uuid.uuid4(), brand_name="Github", brand_id=1) session = UnifiedAlchemyMagicMock() session.add(data) without_specific_columns = session.query(Brand).all() print(f"Object without specific columns: {without_specific_columns}\n" f"Data: {without_specific_columns[0].__dict__}\n") with_specific_columns = session.query(Brand.brand_name).all() print(f"Object with specific columns: {with_specific_columns}") if __name__ == "__main__": test_read_brand_id()
The output will be: Am I missing something or is mock-alchemy not set up for this? Thanks in advance!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi all,
When trying to query specific columns, mock-alchemy seems to return nothing at all.
I wrote this standalone script so you can see what I mean:
The output will be:
Am I missing something or is mock-alchemy not set up for this?
Thanks in advance!
The text was updated successfully, but these errors were encountered: