Esempio n. 1
0
    def begin(
        self,
        autocommit=False,
        readonly=False,
        # after=None, metadata=None, timeout=None
    ):
        """ Begin a new :class:`~py2neo.database.work.Transaction`.

        :param autocommit: (deprecated) if :py:const:`True`, the
            transaction will automatically commit after the first
            operation
        :param readonly: if :py:const:`True`, will begin a readonly
            transaction, otherwise will begin as read-write

        *Changed in version 2020.0: the 'autocommit' argument is now
        deprecated. Use the 'auto' method instead.*
        """
        if autocommit:
            warn(
                "Graph.begin(autocommit=True) is deprecated, "
                "use Graph.auto() instead",
                category=DeprecationWarning,
                stacklevel=2)
        return Transaction(
            self,
            autocommit,
            readonly,
            # after, metadata, timeout
        )
Esempio n. 2
0
    def auto(self,
             # readonly=False, after=None, metadata=None, timeout=None
             ):
        """ Create a new auto-commit :class:`~py2neo.database.work.Transaction`.

        *New in version 2020.0.*
        """
        return Transaction(self, True,
                           # readonly, after, metadata, timeout
                           )
Esempio n. 3
0
    def auto(self, readonly=False,
             # after=None, metadata=None, timeout=None
             ):
        """ Create a new auto-commit :class:`~py2neo.database.work.Transaction`.

        :param readonly: if :py:const:`True`, will begin a readonly
            transaction, otherwise will begin as read-write

        *New in version 2020.0.*
        """
        return Transaction(self, True, readonly,
                           # after, metadata, timeout
                           )