예제 #1
0
 def transaction(
         self,
         transaction_type: TransactionType,
         options: TypeDBClusterOptions = None) -> _TypeDBTransactionImpl:
     if not options:
         options = TypeDBOptions.cluster()
     return self._transaction_any_replica(
         transaction_type, options) if getattr(
             options, "read_any_replica",
             False) else self._transaction_primary_replica(
                 transaction_type, options)
예제 #2
0
 def session(self,
             database: str,
             session_type: SessionType,
             options=None) -> _ClusterSession:
     if not options:
         options = TypeDBOptions.cluster()
     return self._session_any_replica(
         database, session_type, options) if getattr(
             options, "read_any_replica",
             False) else self._session_primary_replica(
                 database, session_type, options)