Skip to content

Conversation

@lemorage
Copy link
Contributor

resolve #618.

@lemorage
Copy link
Contributor Author

and after #758 is resolved we won't need to define types to annotate return values for transform functions

Sorry for keeping this for so long. Said here, does that mean now we can write the code without defining NewParent here, after #758?

@cocoindex.transform_flow()
def for_each_transform(
    data: cocoindex.DataSlice[Parent],
) -> cocoindex.DataSlice[typing.Any]: # No need to specify cocoindex.DataSlice[NewParent]?
    with data["children"].row() as child:
        child["new_field"] = child["value"].transform(extract_value)
    return data
    ```

@badmonster0
Copy link
Member

badmonster0 commented Jul 27, 2025

and after #758 is resolved we won't need to define types to annotate return values for transform functions

Sorry for keeping this for so long. Said here, does that mean now we can write the code without defining NewParent here, after #758?

@cocoindex.transform_flow()
def for_each_transform(
    data: cocoindex.DataSlice[Parent],
) -> cocoindex.DataSlice[typing.Any]: # No need to specify cocoindex.DataSlice[NewParent]?
    with data["children"].row() as child:
        child["new_field"] = child["value"].transform(extract_value)
    return data
    ```

No worries. Yes, that's true. We can rewrite the code without defining NewParent here.

Besides, because of #818, it's still possible that even if returning a dict it still doesn't work as intended (I'll assess #818 more closely later when got time). So if it still doesn't work after a quick try, feel free to comment out the related test first and we can merge it (it means the test is already helping us identifying issues!). Thanks!

@georgeh0
Copy link
Member

and after #758 is resolved we won't need to define types to annotate return values for transform functions

Sorry for keeping this for so long. Said here, does that mean now we can write the code without defining NewParent here, after #758?

@cocoindex.transform_flow()
def for_each_transform(
    data: cocoindex.DataSlice[Parent],
) -> cocoindex.DataSlice[typing.Any]: # No need to specify cocoindex.DataSlice[NewParent]?
    with data["children"].row() as child:
        child["new_field"] = child["value"].transform(extract_value)
    return data
    ```

No worries. Yes, that's true. We can rewrite the code without defining NewParent here.

Besides, because of #818, it's still possible that even if returning a dict it still doesn't work as intended (I'll assess #818 more closely later when got time). So if it still doesn't work after a quick try, feel free to comment out the related test first and we can merge it (it means the test is already helping us identifying issues!). Thanks!

#818 has been fixed in #825 :)

@badmonster0
Copy link
Member

Perfect! Thanks a lot for adding the tests!

@badmonster0 badmonster0 merged commit b87816c into cocoindex-io:main Jul 29, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test on Python side to execute transform flow end to end

3 participants