Skip to content
New issue

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

Feature Request: RowDictMapper should address Join fields #45

Closed
valhuber opened this issue Feb 20, 2024 · 2 comments
Closed

Feature Request: RowDictMapper should address Join fields #45

valhuber opened this issue Feb 20, 2024 · 2 comments
Assignees

Comments

@valhuber
Copy link
Contributor

The current implementation provides only for (aliased) row attributes, but not join attributes.

For example:

class TransferMapper(RowDictMapper):
    """ Format

    Map Transfer row into dict for sending as Kafka message

    Returns:
        _type_: RowDictMapper object
    """
    
    def __init__(self, logic_row: LogicRow = None):
        """ Format

        Map Transfer row into dict for sending as Kafka message

        Note: declare Customer.FirstName (a join field)

        Returns:
            _type_: RowDictMapper object
        """
        transfer = super(TransferMapper, self).__init__(
            model_class=models.Transfer
            , logic_row=logic_row
            , alias = "transfer"
            , fields = [ (logic_row.row.Account.Customer.FirstName, "First"),
                        (logic_row.row.Account.Customer.LastName, "Last"),
                        models.Transfer.FromAccountID, models.Transfer.ToAccountID,
                        models.Transfer.TransactionDate, models.Transfer.Amount
                    ]
            )
        return transfer
@valhuber valhuber self-assigned this Feb 20, 2024
@valhuber
Copy link
Contributor Author

Solution requires breaking change to RowDictMaps:

from logic_bank.exec_row_logic.logic_row import LogicRow

class OrderShipping(RowDictMapper):
    
    def __init__(self, logic_row: LogicRow = None):

@valhuber
Copy link
Contributor Author

Fixed in 10.03.04

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

No branches or pull requests

1 participant