1. snippet / python

    Read selected columns with loadfile

    A small example using local files; install loadfile before running it.

    from loadfile import load
    
    orders = load("data/orders.parquet", columns=["order_id", "amount"])
    print(orders.head())
    
  2. snippet / python

    Validate a positive quantity

    An illustrative request model using Pydantic. Invalid or non-positive quantities raise a validation error.

    from pydantic import BaseModel, Field
    
    class OrderInput(BaseModel):
        product_id: str = Field(min_length=1)
        quantity: int = Field(gt=0)
    
    order = OrderInput(product_id="sample-product", quantity=3)
    

Search projects, articles and notes.