514-labs / moose

The developer framework for your data & analytics stack
https://www.moosejs.com
MIT License
44 stars 8 forks source link

deserialize nested for python streaming function #1818

Closed DatGuyJonathan closed 1 month ago

DatGuyJonathan commented 1 month ago

So in the streaming function, we can do something like activity.child.value instead of activity.child['value']

def parse_activity(activity: UserActivity) -> ParsedActivity:
    child_value = activity.child.value

    return ParsedActivity(
        eventId=activity.eventId,
        timestamp=datetime.fromisoformat(activity.timestamp),
        userId=activity.userId,
        activity=child_value,
    )

my_function = StreamingFunction(
    run=parse_activity
)
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
framework-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:19pm
framework-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:19pm
moose-logs-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:19pm
moose-product-analytics ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2024 3:19pm
DatGuyJonathan commented 1 month ago

@phiSgr , I removed the dict deserialization, but we might need to pair on dataclasses_json. Gonna merge this in for now.