How to use the dallinger.models.Transmission.query.filter_by function in dallinger

To help you get started, we’ve selected a few dallinger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dallinger / Dallinger / dallinger / models.py View on Github external
def transmissions(self, status="all"):
        """Get all the transmissions of this info.

        status can be all/pending/received.
        """
        if status not in ["all", "pending", "received"]:
            raise ValueError(
                "You cannot get transmission of status {}.".format(status)
                + "Status can only be pending, received or all"
            )
        if status == "all":
            return Transmission.query.filter_by(info_id=self.id, failed=False).all()
        else:
            return Transmission.query.filterby(
                info_id=self.id, status=status, failed=False
            ).all()
github Dallinger / Dallinger / dallinger / models.py View on Github external
and_(
                            Transmission.failed == false(),
                            Transmission.status == status,
                            or_(
                                Transmission.destination_id == self.id,
                                Transmission.origin_id == self.id,
                            ),
                        )
                    )
                    .order_by("creation_time")
                    .all()
                )
        if direction == "incoming":
            if status == "all":
                return (
                    Transmission.query.filter_by(failed=False, destination_id=self.id)
                    .order_by("creation_time")
                    .all()
                )
            else:
                return (
                    Transmission.query.filter(
                        and_(
                            Transmission.failed == false(),
                            Transmission.destination_id == self.id,
                            Transmission.status == status,
                        )
                    )
                    .order_by("creation_time")
                    .all()
                )
        if direction == "outgoing":
github Dallinger / Dallinger / dallinger / models.py View on Github external
status { "all", "received", "pending" }
        failed { False, True, "all" }
        To get transmissions from a specific vector, see the
        transmissions() method in class Vector.
        """
        if status not in ["all", "pending", "received"]:
            raise ValueError(
                "You cannot get transmission of status {}.".format(status)
                + "Status can only be pending, received or all"
            )
        if failed not in ["all", False, True]:
            raise ValueError("{} is not a valid failed".format(failed))

        if status == "all":
            if failed == "all":
                return Transmission.query.filter_by(network_id=self.id).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, failed=failed
                ).all()
        else:
            if failed == "all":
                return Transmission.query.filter_by(
                    network_id=self.id, status=status
                ).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, status=status, failed=failed
                ).all()
github Dallinger / Dallinger / dallinger / models.py View on Github external
To get transmissions from a specific vector, see the
        transmissions() method in class Vector.
        """
        if status not in ["all", "pending", "received"]:
            raise ValueError(
                "You cannot get transmission of status {}.".format(status)
                + "Status can only be pending, received or all"
            )
        if failed not in ["all", False, True]:
            raise ValueError("{} is not a valid failed".format(failed))

        if status == "all":
            if failed == "all":
                return Transmission.query.filter_by(network_id=self.id).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, failed=failed
                ).all()
        else:
            if failed == "all":
                return Transmission.query.filter_by(
                    network_id=self.id, status=status
                ).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, status=status, failed=failed
                ).all()
github Dallinger / Dallinger / dallinger / models.py View on Github external
def transmissions(self, status="all"):
        """Get transmissions sent along this Vector.

        Status can be "all" (the default), "pending", or "received".
        """
        if status not in ["all", "pending", "received"]:
            raise ValueError(
                "You cannot get {} transmissions.".format(status)
                + "Status can only be pending, received or all"
            )

        if status == "all":
            return Transmission.query.filter_by(vector_id=self.id, failed=False).all()
        else:
            return Transmission.query.filter_by(
                vector_id=self.id, status=status, failed=False
            ).all()
github Dallinger / Dallinger / dallinger / models.py View on Github external
else:
                return (
                    Transmission.query.filter(
                        and_(
                            Transmission.failed == false(),
                            Transmission.destination_id == self.id,
                            Transmission.status == status,
                        )
                    )
                    .order_by("creation_time")
                    .all()
                )
        if direction == "outgoing":
            if status == "all":
                return (
                    Transmission.query.filter_by(failed=False, origin_id=self.id)
                    .order_by("creation_time")
                    .all()
                )
            else:
                return (
                    Transmission.query.filter(
                        and_(
                            Transmission.failed == false(),
                            Transmission.origin_id == self.id,
                            Transmission.status == status,
                        )
                    )
                    .order_by("creation_time")
                    .all()
github Dallinger / Dallinger / dallinger / models.py View on Github external
def transmissions(self, status="all"):
        """Get transmissions sent along this Vector.

        Status can be "all" (the default), "pending", or "received".
        """
        if status not in ["all", "pending", "received"]:
            raise ValueError(
                "You cannot get {} transmissions.".format(status)
                + "Status can only be pending, received or all"
            )

        if status == "all":
            return Transmission.query.filter_by(vector_id=self.id, failed=False).all()
        else:
            return Transmission.query.filter_by(
                vector_id=self.id, status=status, failed=False
            ).all()
github Dallinger / Dallinger / dallinger / models.py View on Github external
raise ValueError("{} is not a valid failed".format(failed))

        if status == "all":
            if failed == "all":
                return Transmission.query.filter_by(network_id=self.id).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, failed=failed
                ).all()
        else:
            if failed == "all":
                return Transmission.query.filter_by(
                    network_id=self.id, status=status
                ).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, status=status, failed=failed
                ).all()